Module: Supercast::Operations::Save::ClassMethods
- Defined in:
- lib/supercast/operations/save.rb
Instance Method Summary collapse
-
#update(id, params = {}, opts = {}) ⇒ Object
Updates an API resource.
Instance Method Details
#update(id, params = {}, opts = {}) ⇒ Object
Updates an API resource
Updates the identified resource with the passed in parameters.
Attributes
-
id
- ID of the resource to update. -
params
- A hash of parameters to pass to the API -
opts
- A Hash of additional options (separate from the params / object values) to be added to the request.
17 18 19 20 21 22 23 24 |
# File 'lib/supercast/operations/save.rb', line 17 def update(id, params = {}, opts = {}) params.each_key do |k| raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k) end resp, opts = request(:patch, "#{resource_url}/#{id}", Hash[object_name => params], opts) Util.convert_to_supercast_object(resp.data, opts) end |