Module: Signnow::Operations::Update::ClassMethods

Defined in:
lib/signnow/operations/update.rb

Instance Method Summary collapse

Instance Method Details

#options_for_update(attributes) ⇒ Hash

Options for update overwrite this in the model to set security

Returns:

Raises:



29
30
31
32
33
34
35
36
# File 'lib/signnow/operations/update.rb', line 29

def options_for_update(attributes)
  access_token = attributes.delete(:access_token)
  raise AuthenticationError unless access_token
  {
    auth_type: :user_token,
    auth_token: access_token
  }
end

#update_attributes(attributes = {}) ⇒ Object

Updates a object

Parameters:

  • The id of the object that should be updated

  • (defaults to: {})

    The attributes that should be updated



9
10
11
12
13
# File 'lib/signnow/operations/update.rb', line 9

def update_attributes(attributes={})
  id = attributes.delete(:id)
  response = Signnow.request(:put, nil, api_update_url(id), attributes, options_for_update(attributes))
  self.new(response["data"])
end