Method: Stripe::APIOperations::Save::ClassMethods#update
- Defined in:
- lib/stripe/api_operations/save.rb
#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. E.g. to allow for an idempotency_key to be passed in the request headers, or for the api_key to be overwritten. See APIOperations::Request.request.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stripe/api_operations/save.rb', line 19 def update(id, params = {}, opts = {}) params.each_key do |k| if protected_fields.include?(k) raise ArgumentError, "Cannot update protected field: #{k}" end end resp, opts = request(:post, "#{resource_url}/#{id}", params, opts) Util.convert_to_stripe_object(resp.data, opts) end |