ruby_universign 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 11f8da6678fe2eabbade54811eadfcb73fd97d05
4
- data.tar.gz: d72c7cc029d9de15de14da7ab6ba466f1913aa0f
2
+ SHA256:
3
+ metadata.gz: be66f3f3888dfa5be80ae0a7b04bb24abdcd1d968459fe947155195354774323
4
+ data.tar.gz: e8a8bb26267e7b475f29f36bb2e5d019b18766c29e0a1381f2cfff20c2ee302b
5
5
  SHA512:
6
- metadata.gz: 60ed3572c4fcee9a15f5918a439e174cfaf6ef1731988f73beab96e9a3779cbdc6623ef1e4defa472981b3d00116cbdfef61f1d81387c322408b53faadeafb6e
7
- data.tar.gz: eaa7ba2fed5b941647c054f1dc73440939685f0e27eab1b59804e20cf2372636524203db95b0a3282825025bf94a269c227f24bd3029c2dc3e237929361ca873
6
+ metadata.gz: dbe62e8c57efec45a9680380e478564750d8cdae030cd59697a7b6cd02ce49410a2fc1465c03729eca7f1d725f1669b6aef19933069b964e94295a69c7e2b6bb
7
+ data.tar.gz: fb66dd95ce4c4806217ac2f921148823de882045b845631bee2f564470a3d53b768f014aa4becb3a8612f9ee6e3499d3e3faaa4d2526681828702d1d0b5087cc
@@ -1,7 +1,24 @@
1
- v???
1
+ v1.2.0
2
2
  -------------------------
3
3
 
4
- - rename gem to `ruby_universign` and `ESign` module to `Universign`
4
+ - Add `chaining_mode` to `Universign::Transaction` options.
5
+
6
+ v1.1.1
7
+ -------------------------
8
+
9
+ - bugfix : do not add `name` parameter to SignatureField when it's nil.
10
+
11
+ v1.1.0
12
+ -------------------------
13
+
14
+ - SignatureField can be managed with a named field instead of coordinates.
15
+
16
+ v1.0.0
17
+ -------------------------
18
+
19
+ - rename gem to `ruby_universign`
20
+ - rename`ESign` module to `Universign`
21
+ - release gem on rubygems
5
22
 
6
23
  v0.1.6 (26/11/2015)
7
24
  -------------------------
data/README.md CHANGED
@@ -4,7 +4,7 @@ RubyUniversign is a Ruby gem for interacting with [Universign](https://www.unive
4
4
 
5
5
  It ease requests to Universign API, documents uploads and following signature state.
6
6
 
7
- This gem is **not** officialy made by Universign, but was originally created for [CapSens](https://capsens.eu/) internal usage.
7
+ This gem is **not** officialy made by Universign, but was originally created by [CapSens](https://capsens.eu/) for internal usage.
8
8
 
9
9
  This gem currently integrate electronic signature service, but not other Universign services (timestamping and server stamp).
10
10
 
@@ -83,6 +83,33 @@ transaction = Universign::Transaction.new('9696179e-a43d-4803-beeb-9e5c02fd159b'
83
83
  transaction.signed?
84
84
  ```
85
85
 
86
+ The gem also supports the updated way of creating multiple signature fields per document:
87
+
88
+ ```ruby
89
+ doc_1 = Universign::Document.new(
90
+ name: 'one.pdf',
91
+ content: File.open('spec/fixtures/universign-guide-8.8.pdf').read,
92
+ signature_fields: [
93
+ Universign::SignatureField.new(coordinate: [20, 20], page: 1, signer_index: 0),
94
+ Universign::SignatureField.new(coordinate: [80, 20], page: 1, signer_index: 0)
95
+ ]
96
+ )
97
+
98
+ doc_2 = Universign::Document.new(
99
+ name: 'two.pdf',
100
+ content: File.open('spec/fixtures/universign-guide-8.8.pdf').read,
101
+ signature_fields: [
102
+ Universign::SignatureField.new(coordinate: [100, 120], page: 4, signer_index: 0),
103
+ ]
104
+ )
105
+
106
+ transaction = Universign::Transaction.create(
107
+ documents: [doc_1, doc_2],
108
+ signers: [signer],
109
+ options: { profile: 'default', final_doc_sent: true }
110
+ )
111
+ ```
112
+
86
113
  ### `Universign::Document`
87
114
 
88
115
  It can be created with either your file's content or your file's url.
@@ -91,6 +118,10 @@ It can be created with either your file's content or your file's url.
91
118
 
92
119
  Nothing much to say here. It follows Universign's signature field.
93
120
 
121
+ You can pass the coordinates of the signature or the name of the field.
122
+
123
+ If the PDF already contains a named signature field, you can use this parameter instead of giving the coordinates (which will be ignored). If the name of this field does not exist in the document, the given coordinates will be used instead.
124
+
94
125
  ### `Universign::TransactionSigner`
95
126
 
96
127
  * `success_url` is where your user will be redirected after signing the documents.
@@ -114,6 +145,7 @@ handwritten_signature
114
145
  profile
115
146
  final_doc_sent
116
147
  final_doc_requester_sent
148
+ chaining_mode
117
149
  ```
118
150
 
119
151
  Default options are:
@@ -135,7 +167,7 @@ Once your transaction is created:
135
167
 
136
168
  ## Universign documentation
137
169
 
138
- As of September 25th 2018, all official Universign documentation can be found at [https://help.universign.com/hc/fr/sections/360000148149-Guides-Universign]().
170
+ As of September 25th 2018, all official Universign documentation can be found at https://help.universign.com/hc/fr/sections/360000148149-Guides-Universign.
139
171
 
140
172
  ## Development
141
173
 
@@ -75,6 +75,19 @@ module Universign
75
75
  params['name'] = data
76
76
  end
77
77
 
78
+ def signature_fields=(data)
79
+ if !data.is_a?(Array)
80
+ raise 'SignatureFieldsMustBeAnArray'
81
+ end
82
+
83
+ @signature_fields = data
84
+ params['signatureFields'] = data.map do |d|
85
+ raise 'BadSignatureFieldType' unless d.instance_of?(SignatureField)
86
+
87
+ d.params
88
+ end
89
+ end
90
+
78
91
  # The meta data of the PDF document
79
92
  #
80
93
  # @return [Hash]
@@ -11,7 +11,8 @@ module Universign
11
11
  handwritten_signature: :handwrittenSignature,
12
12
  profile: :profile,
13
13
  final_doc_sent: :finalDocSent,
14
- final_doc_requester_sent: :finalDocRequesterSent
14
+ final_doc_requester_sent: :finalDocRequesterSent,
15
+ chaining_mode: :chainingMode
15
16
  }
16
17
 
17
18
  DEFAULT_OPTIONS = {
@@ -2,15 +2,22 @@ module Universign
2
2
  class SignatureField
3
3
  attr_reader :params
4
4
 
5
- def initialize(coordinate:, page:)
6
- @coordinate = coordinate
5
+ def initialize(coordinate:, name: nil, page:, signer_index:)
6
+ @coordinate = coordinate || [0, 0]
7
+ @name = name
7
8
  @page = page
9
+ @signer_index = signer_index
8
10
 
9
11
  @params = {
10
- page: @page,
11
- x: @coordinate[0],
12
- y: @coordinate[1]
12
+ page: @page,
13
+ x: @coordinate[0],
14
+ y: @coordinate[1],
15
+ 'signerIndex': @signer_index
13
16
  }
17
+
18
+ @params[:name] = @name unless @name.nil?
19
+
20
+ @params
14
21
  end
15
22
  end
16
23
  end
@@ -1,3 +1,3 @@
1
1
  module Universign
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -11,9 +11,9 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = "Universign's API Wrapper"
13
13
  spec.description = <<~EOF
14
- Ruby gem for interacting with [Universign](https://www.universign.com/) electronic signature API.
14
+ Ruby gem for interacting with Universign electronic signature API.
15
15
  It ease requests to Universign API, documents uploads and following signature state.
16
- This gem is **not** officialy made by Universign, but was originally created for [CapSens](https://capsens.eu/) internal usage.
16
+ This gem is *not* officialy made by Universign, but was originally created by CapSens for internal usage.
17
17
  EOF
18
18
  spec.homepage = "https://github.com/CapSens/universign"
19
19
  spec.license = "MIT"
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency 'activesupport', '>= 4.1'
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rake", ">= 12.3.3"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
33
  spec.add_development_dependency "dotenv", "~> 2.0"
34
34
  spec.add_development_dependency "webmock", "~> 3.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_universign
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Besnard
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-09-26 00:00:00.000000000 Z
13
+ date: 2020-11-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -44,16 +44,16 @@ dependencies:
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '10.0'
49
+ version: 12.3.3
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '10.0'
56
+ version: 12.3.3
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rspec
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -111,9 +111,9 @@ dependencies:
111
111
  - !ruby/object:Gem::Version
112
112
  version: '4.0'
113
113
  description: |
114
- Ruby gem for interacting with [Universign](https://www.universign.com/) electronic signature API.
114
+ Ruby gem for interacting with Universign electronic signature API.
115
115
  It ease requests to Universign API, documents uploads and following signature state.
116
- This gem is **not** officialy made by Universign, but was originally created for [CapSens](https://capsens.eu/) internal usage.
116
+ This gem is *not* officialy made by Universign, but was originally created by CapSens for internal usage.
117
117
  email:
118
118
  - besnard.nicolas@gmail.com
119
119
  - yassine@capsens.eu
@@ -148,7 +148,6 @@ files:
148
148
  - lib/universign/transaction.rb
149
149
  - lib/universign/transaction_signer.rb
150
150
  - lib/universign/version.rb
151
- - ruby_universign-0.2.0.gem
152
151
  - ruby_universign.gemspec
153
152
  homepage: https://github.com/CapSens/universign
154
153
  licenses:
@@ -169,8 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
168
  - !ruby/object:Gem::Version
170
169
  version: '0'
171
170
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.6.8
171
+ rubygems_version: 3.0.3
174
172
  signing_key:
175
173
  specification_version: 4
176
174
  summary: Universign's API Wrapper
Binary file