Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial working xmlrpc hook for ifttt
- Loading branch information
0 parents
commit 8d28ca5
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'builder' | ||
require 'rack/rpc' | ||
|
||
class Server < Rack::RPC::Server | ||
def supported_methods(arg1) | ||
# Give an endpoint for authentication purposes | ||
'metaWeblog.getRecentPosts' | ||
end | ||
rpc 'mt.supportedMethods' => :supported_methods | ||
|
||
def recent_posts(blog_id, username, password, number_of_posts) | ||
# Return nothing so we never trigger | ||
'<array><data></data></array>' | ||
end | ||
rpc 'metaWeblog.getRecentPosts' => :recent_posts | ||
|
||
def new_post(blog_id, user, password, content, publish) | ||
# Webhook | ||
puts content['title'] | ||
puts content['description'] | ||
puts content['categories'] | ||
puts content['mt_keywords'][0] | ||
puts content['post_status'] | ||
'<string>200</string>' | ||
end | ||
rpc 'metaWeblog.newPost' => :new_post | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require './app' | ||
|
||
# config.ru | ||
use Log | ||
use Rack::RPC::Endpoint, Server.new, :path => "/xmlrpc.php" | ||
|
||
app = proc do |env| | ||
[ 200, {'Content-Type' => 'text/plain'}, ["a"] ] | ||
end | ||
|
||
run app |