Class: Change::Resources::SignatureCollection

Inherits:
CollectionResource show all
Defined in:
lib/resources/signature_collection.rb

Instance Attribute Summary

Attributes inherited from CollectionResource

#collection, #parent_resource

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from CollectionResource

collection_name, #initialize, #load

Methods inherited from Resource

#auth_key=, #endpoint, #initialize, #make_request, #needs_authorization?, #needs_request_signature?, #request_auth_key

Constructor Details

This class inherits a constructor from Change::Resources::CollectionResource

Instance Method Details

#add_signature(params = {}, auth_key_to_use = nil) ⇒ Object



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

def add_signature(params = {}, auth_key_to_use = nil)
  auth_key_to_use ||= auth_key
  raise "No auth key specified." if auth_key_to_use.nil?
  raise "Petition not loaded." if @parent_resource.id.nil?
  params[:auth_key_to_use] = auth_key_to_use
  params[:source] = auth_key_to_use['source']
  response = make_request(:collection, { :method => :post }, params)
  response['result'] == 'success'
end

#auth_keyObject



5
6
7
# File 'lib/resources/signature_collection.rb', line 5

def auth_key
  @parent_resource.auth_key
end