Class: Agree2::Party

Inherits:
Base
  • Object
show all
Defined in:
lib/agree2/party.rb

Instance Attribute Summary

Attributes inherited from Base

#container, #user

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attr_serializable, #attributes, collection_name, collection_path, #destroy, get, #initialize, instance_path, #new_record?, #path, #reload, #save, serializable_attributes, singular_name, #to_param, #to_url

Constructor Details

This class inherits a constructor from Agree2::Base

Class Method Details

.validate_parties_hash(parties) ⇒ Object

:nodoc:



13
14
15
16
# File 'lib/agree2/party.rb', line 13

def self.validate_parties_hash(parties)  #:nodoc:
  parties&&parties.each{|r,p| validate_party_hash(p)}
  true
end

.validate_party_hash(p) ⇒ Object

:nodoc:

Raises:

  • (ArgumentError)


18
19
20
21
# File 'lib/agree2/party.rb', line 18

def self.validate_party_hash(p)  #:nodoc:
  raise ArgumentError,"Your parties are missing required fields" if [:first_name,:last_name,:email].find{|k| !p.include?(k)}
  return true
end

Instance Method Details

#presentObject

Creates a one time signed url to redirect your user to their acceptance page. This url is only valid once. Call again to redirect your user to the agreement again.



8
9
10
11
# File 'lib/agree2/party.rb', line 8

def present
  path="/present/#{agreement.permalink}/to/#{email}"
  AGREE2_URL+user.client.consumer.create_signed_request(:get,path,user.access_token,{:scheme=>:query_string}).path
end