Skip to content

Commit

Permalink
Initial working xmlrpc hook for ifttt
Browse files Browse the repository at this point in the history
  • Loading branch information
mcolyer committed Jan 2, 2013
0 parents commit 8d28ca5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app.rb
@@ -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
11 changes: 11 additions & 0 deletions config.ru
@@ -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

0 comments on commit 8d28ca5

Please sign in to comment.