Class: Esignatur::SourceDocument
- Inherits:
-
Object
- Object
- Esignatur::SourceDocument
- Includes:
- ApiResource
- Defined in:
- lib/esignatur/source_document.rb
Overview
esignature SourceDocument document representation. More info: api.esignatur.dk/Documentation/SourceDocument
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
- #fetch ⇒ Object
-
#initialize(order:, api:) ⇒ SourceDocument
constructor
A new instance of SourceDocument.
Methods included from ApiResource
Constructor Details
#initialize(order:, api:) ⇒ SourceDocument
Returns a new instance of SourceDocument.
13 14 15 16 17 |
# File 'lib/esignatur/source_document.rb', line 13 def initialize(order:, api:) @attributes = {} @order = order @api = api end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/esignatur/source_document.rb', line 11 def attributes @attributes end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
11 12 13 |
# File 'lib/esignatur/source_document.rb', line 11 def order @order end |
Instance Method Details
#document_data ⇒ Object
19 20 21 22 |
# File 'lib/esignatur/source_document.rb', line 19 def document_data fetch if attributes.empty? Base64.decode64(attributes.fetch('DocumentData')) end |
#fetch ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/esignatur/source_document.rb', line 24 def fetch response = api_post( 'SourceDocument/Download', { 'Id' => order.id, 'DocumentIndex' => 0 } ) @attributes = response.json_body if errors.empty? self end |