Class: Universign::Transaction

Inherits:
Object
  • Object
show all
Includes:
Safeguard, Service::Document, Service::Transaction
Defined in:
lib/universign/transaction.rb

Constant Summary

Constants included from Service::Transaction

Service::Transaction::AVAILABLE_OPTIONS, Service::Transaction::DEFAULT_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Service::Document

#documents, included

Methods included from Service::Transaction

#get, included

Methods included from Safeguard

included, #safeguard

Constructor Details

#initialize(transaction_id = nil, url = nil) ⇒ Transaction

Returns a new instance of Transaction.



9
10
11
12
13
14
15
# File 'lib/universign/transaction.rb', line 9

def initialize(transaction_id = nil, url = nil)
  @transaction_id = transaction_id
  @url            = url
  @data           = {}

  self.get
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/universign/transaction.rb', line 7

def data
  @data
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



7
8
9
# File 'lib/universign/transaction.rb', line 7

def transaction_id
  @transaction_id
end

#urlArray<String> (readonly)

Returns:

  • (Array<String>)


37
38
39
# File 'lib/universign/transaction.rb', line 37

def url
  @url
end

Instance Method Details

#created_atDate

The creation date or last relaunch date of this transaction

Returns:

  • (Date)


67
68
69
# File 'lib/universign/transaction.rb', line 67

def created_at
  data['creationDate'].to_date
end

#current_signerInteger

The index of current signer if the status of transaction is ready or who ended the transactions for other status

Returns:

  • (Integer)


60
61
62
# File 'lib/universign/transaction.rb', line 60

def current_signer
  data['currentSigner']
end

#descriptionString

The description of the Transaction

Returns:

  • (String)


74
75
76
# File 'lib/universign/transaction.rb', line 74

def description
  data['description']
end

#each_fieldBoolean

Whether the transaction was requested with requesting handwritten signature for each signature field or not.

Returns:

  • (Boolean)


82
83
84
# File 'lib/universign/transaction.rb', line 82

def each_field
  data['eachField']
end

#from_data(data) ⇒ Object



17
18
19
# File 'lib/universign/transaction.rb', line 17

def from_data(data)
  @data = data
end

#initiatorObject

A bean containing information about the requester of a transaction

Returns:



52
53
54
# File 'lib/universign/transaction.rb', line 52

def initiator
  data['initiatorInfo']
end

#signed?Boolean

Whether the transaction is signed… or not !

Returns:

  • (Boolean)


89
90
91
# File 'lib/universign/transaction.rb', line 89

def signed?
  status == 'completed'
end

#signersArray<Universign::Signer]

A list of bean containing information about the signers and their progression in the signature process

Returns:



45
46
47
# File 'lib/universign/transaction.rb', line 45

def signers
  raise 'NotImplementedYet'
end

#statusString

The status of the transaction. The existing statuses are:

| Status | Description | |————-|————————————————————————————————–| | ‘ready` | Signers can connect and sign | | `expired` | The transaction has been requested more than 7 days ago. It will no more be available to signers | | `canceled` | A signer has canceled the transaction. Signers will no more be able to connect to the service | | `failed` | An error occured during a signature. The signers won’t be able to connect to the service | | `completed` | All signers have successfuly sign, the requester can retrieve the documents |

Returns:

  • (String)


32
33
34
# File 'lib/universign/transaction.rb', line 32

def status
  data['status']
end