esignatur 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 329f23bcf2dbcdec7cdf664be600d6832c871ccb898e1f5b5b20b05164eba484
4
- data.tar.gz: f1b951c3c7d4c4514f5bcfc0b09564732de6f9336bb0a4265e1ba93c75413bca
3
+ metadata.gz: d5497bbf3753aeee76333422aa348fd1aa2deb20bf2c465c137343cad2d49e4f
4
+ data.tar.gz: e53684532371b8343322af602cb32ed9e906f36024870b1ad6600b35ab103f74
5
5
  SHA512:
6
- metadata.gz: fb70b2bad463b1e45e9fbf1f4c7774fd774eb9845208577aa09bce2db5ed6b0c0f33808fffbcb91aad95b892ed14d80865fb1cb98278e254cb66f2762bffc30d
7
- data.tar.gz: 765e371eb72d3e3acaee890ce8fd71e6a97947ae9e3627a01c830755bd01945113f8678d826f9e61ae5f4bd200d5c3248c500b5bb08f6b06734e9c5298b339f1
6
+ metadata.gz: a3a2ee4c7675b8d825d092ea7466ed85b4a5ac8cd2106a2bfa6d3cbe4009339e79e25fcb9fe336f436fd5176ef9c3fbfd4ca3f6bc2084d305e3c6c34416df71b
7
+ data.tar.gz: 99905e58881f89e8d5aad3070cb03655cb4753a9ef2f922efbf672654e823c1fa40ccab0f0ecd5781f571c13dece480c94553c5317ac0e870773e60471018358
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'esignatur/api_resource'
4
4
  require 'esignatur/pades'
5
+ require 'esignatur/source_document'
5
6
  require 'esignatur/status'
6
7
  require 'active_support/core_ext/string/inflections'
7
8
 
@@ -49,6 +50,10 @@ module Esignatur
49
50
  @pades ||= Esignatur::Pades.new(order: self, api: api)
50
51
  end
51
52
 
53
+ def source_document
54
+ @source_document ||= Esignatur::SourceDocument.new(order: self, api: api)
55
+ end
56
+
52
57
  private
53
58
 
54
59
  attr_reader :api
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'esignatur/api_resource'
4
+
5
+ module Esignatur
6
+ # esignature SourceDocument document representation.
7
+ # More info: https://api.esignatur.dk/Documentation/SourceDocument
8
+ class SourceDocument
9
+ include ApiResource
10
+
11
+ attr_reader :attributes, :order
12
+
13
+ def initialize(order:, api:)
14
+ @attributes = {}
15
+ @order = order
16
+ @api = api
17
+ end
18
+
19
+ def document_data
20
+ fetch if attributes.empty?
21
+ Base64.decode64(attributes.fetch('DocumentData'))
22
+ end
23
+
24
+ def fetch
25
+ response = api_post('SourceDocument/Download',
26
+ 'Id' => order.id, 'DocumentIndex' => 0)
27
+ @attributes = response.json_body if errors.empty?
28
+ self
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :api
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Esignatur
4
- VERSION = '1.2.2'
4
+ VERSION = '1.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esignatur
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -196,6 +196,7 @@ files:
196
196
  - lib/esignatur/order.rb
197
197
  - lib/esignatur/orders.rb
198
198
  - lib/esignatur/pades.rb
199
+ - lib/esignatur/source_document.rb
199
200
  - lib/esignatur/status.rb
200
201
  - lib/esignatur/version.rb
201
202
  homepage: https://github.com/samesystem/esignatur