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_read_only, attr_serializable, #attributes, collection_name, collection_path, #destroy, get, #initialize, instance_path, #new_record?, #path, read_only_attributes, #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:



22
23
24
25
# File 'lib/agree2/party.rb', line 22

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)


27
28
29
30
# File 'lib/agree2/party.rb', line 27

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.



10
11
12
13
# File 'lib/agree2/party.rb', line 10

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

#statusObject

Status of party new|invited|accepted|declined



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

def status
  @status||=load_state
end