Skip to content

Instantly share code, notes, and snippets.

@richo
Created October 20, 2011 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richo/1300716 to your computer and use it in GitHub Desktop.
Save richo/1300716 to your computer and use it in GitHub Desktop.
module Twat::Endpoints
class Identica
def initialize
::Twitter::Request.module_eval do
def request(method, path, params, options)
# Needs original method body, seems to be impossible to call original
# implementation
# FIXME subclass the whole show?
path.gsub!(%r|^1/|, '')
response = connection(options).send(method) do |request|
case method.to_sym
when :get, :delete
request.url(formatted_path(path, options), params)
when :post, :put
request.path = formatted_path(path, options)
request.body = params unless params.empty?
end
end
options[:raw] ? response : response.body
end
end
end
def url
"https://identi.ca/api"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment