Method: Insightly::ReadWrite#put_collection

Defined in:
lib/insightly/read_write.rb

#put_collection(path, params, content_selector = :json) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/insightly/read_write.rb', line 35

def put_collection(path, params, content_selector = :json)
  if content_selector == :xml_raw
    content_type = :xml
  else
    content_type = content_selector
  end
  response = RestClient::Request.new(:method => :put,
                                     :url => "#{config.endpoint}/#{path.to_s}",
                                     :user => config.api_key,
                                     :password => "",
                                     :payload => params,
                                     :headers => {:accept => content_type, :content_type => content_type}).execute
  process(response, content_selector)
end