Class: ActionNetworkRest::Signatures

Inherits:
Base
  • Object
show all
Defined in:
lib/action_network_rest/signatures.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#get, #list

Instance Attribute Details

#petition_idObject

Returns the value of attribute petition_id.



3
4
5
# File 'lib/action_network_rest/signatures.rb', line 3

def petition_id
  @petition_id
end

Instance Method Details

#base_pathObject



5
6
7
# File 'lib/action_network_rest/signatures.rb', line 5

def base_path
  "petitions/#{url_escape(petition_id)}/signatures/"
end

#create(signature_data, tags: []) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/action_network_rest/signatures.rb', line 9

def create(signature_data, tags: [])
  post_body = signature_data
  if tags.any?
    post_body['add_tags'] = tags
  end

  response = client.post_request base_path, post_body
  object_from_response(response)
end

#update(id, signature_data) ⇒ Object



19
20
21
22
# File 'lib/action_network_rest/signatures.rb', line 19

def update(id, signature_data)
  response = client.put_request "#{base_path}#{url_escape(id)}", signature_data
  object_from_response(response)
end