Method: CrowdFlower::Connection#method_missing

Defined in:
lib/crowdflower/base.rb

#method_missing(method_id, *args) ⇒ Object

get, post, put and delete methods



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/crowdflower/base.rb', line 67

def method_missing(method_id, *args)
  if [:get, :post, :put, :delete].include?(method_id)
    path, options = *args
    options ||= {}
    options[:query] = (default_params.merge(options[:query] || {}))
    options[:headers] = (self.class.default_options[:headers].merge(options[:headers] || {}))

    CrowdFlower.request_hook.call(method_id, path, options) do
      self.class.send(method_id, url(path), options)
    end
  else
    super
  end
end