Sha256: a8de2336d2a14abf08877bbe89e3d59a070439256b743f7ed21eaf45736f4aff
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Thounds # Wrapper for the Thounds REST API # # @note See the {http://developers.thounds.com/doc Thounds API Documentation} for more informations. # @see http://developers.thounds.com class Client < API # Require client method modules after initializing the Client class in # order to avoid a superclass mismatch error, allowing those modules to be # Client-namespaced. Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f} alias :api_endpoint :endpoint attr_reader :proxy def initialize(options={}) super(options) @proxy = Proxy.new end # Delegate to Thounds::Client def method_missing(method, *args, &block) options = args.last.is_a?(Hash) ? args.pop : {} id = args.last ? args.pop : nil # puts "method: #{method}" # puts "options: #{options.inspect}" # puts "id: #{id}" @proxy.append(method, id, options) if block_given? @proxy.compose_request yield send(:request, @proxy.verb, @proxy.path, @proxy.options) end self # begin # send(verb, path, options) # rescue Yajl::ParseError => e # puts "error: #{e}" # end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thounds-0.0.2 | lib/thounds/client.rb |
thounds-0.0.1 | lib/thounds/client.rb |