Class: Esignatur::Pades
- Inherits:
-
Object
- Object
- Esignatur::Pades
- Includes:
- ApiResource
- Defined in:
- lib/esignatur/pades.rb
Overview
esignature PAdES document representation. More info: api.esignatur.dk/Documentation/Pades
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #document_data ⇒ Object
- #document_id ⇒ Object
- #fetch ⇒ Object
- #filename ⇒ Object
-
#initialize(order:, attributes: {}, api:) ⇒ Pades
constructor
A new instance of Pades.
- #title ⇒ Object
Methods included from ApiResource
Constructor Details
#initialize(order:, attributes: {}, api:) ⇒ Pades
Returns a new instance of Pades.
13 14 15 16 17 |
# File 'lib/esignatur/pades.rb', line 13 def initialize(order:, attributes: {}, api:) @attributes = attributes @order = order @api = api end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/esignatur/pades.rb', line 11 def attributes @attributes end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
11 12 13 |
# File 'lib/esignatur/pades.rb', line 11 def order @order end |
Instance Method Details
#document_data ⇒ Object
19 20 21 22 |
# File 'lib/esignatur/pades.rb', line 19 def document_data fetch unless attributes.key?('DocumentData') Base64.decode64(attributes.fetch('DocumentData')) end |
#document_id ⇒ Object
34 35 36 37 |
# File 'lib/esignatur/pades.rb', line 34 def document_id fetch unless attributes.key?('DocumentId') attributes['DocumentId'] end |
#fetch ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/esignatur/pades.rb', line 39 def fetch response = api_post( 'Pades/Download', { 'Id' => order.id, 'AgreementId' => attributes['AgreementId'] } ) @attributes = response.json_body if errors.empty? self end |
#filename ⇒ Object
29 30 31 32 |
# File 'lib/esignatur/pades.rb', line 29 def filename fetch unless attributes.key?('Filename') attributes['Filename'] end |
#title ⇒ Object
24 25 26 27 |
# File 'lib/esignatur/pades.rb', line 24 def title fetch unless attributes.key?('Title') attributes['Title'] end |