lib/restful_model.rb in inbox-0.17.4 vs lib/restful_model.rb in inbox-0.18.0
- old
+ new
@@ -29,15 +29,15 @@
parameters.each do |property_name|
send("#{property_name}=", json[property_name]) if json.has_key?(property_name)
end
end
- def save!
+ def save!(params={})
if id
- update('PUT', '', as_json())
+ update('PUT', '', as_json(), params)
else
- update('POST', '', as_json())
+ update('POST', '', as_json(), params)
end
end
def url(action = "")
action = "/#{action}" unless action.empty?
@@ -56,13 +56,13 @@
end
end
hash
end
- def update(http_method, action, data = {})
+ def update(http_method, action, data = {}, params = {})
http_method = http_method.downcase
- ::RestClient.send(http_method, self.url(action), data.to_json, :content_type => :json) do |response, request, result|
+ ::RestClient.send(http_method, self.url(action), data.to_json, :content_type => :json, :params => params) do |response, request, result|
unless http_method == 'delete'
json = Inbox.interpret_response(result, response, :expected_class => Object)
inflate(json)
end
end