hello_sign 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
1
  require 'hello_sign/file'
2
+ require 'json'
2
3
 
3
4
  module HelloSign
4
5
  module Parameters
5
6
  class SignatureRequest
6
- attr_accessor :title, :subject, :message, :ccs, :form_fields_per_document
7
- private :title, :subject, :message, :ccs, :form_fields_per_document
7
+ attr_accessor :title, :subject, :message, :ccs
8
+ private :title, :subject, :message, :ccs
8
9
 
9
- attr_writer :signers, :files
10
+ attr_writer :signers, :files, :form_fields_per_document
10
11
 
11
12
  def formatted
12
13
  {
@@ -16,7 +17,7 @@ module HelloSign
16
17
  cc_email_addresses: ccs,
17
18
  signers: formatted_signers,
18
19
  file: formatted_files,
19
- form_fields_per_document: form_fields_per_document
20
+ form_fields_per_document: formatted_form_fields_per_document
20
21
  }
21
22
  end
22
23
 
@@ -24,7 +25,7 @@ module HelloSign
24
25
 
25
26
  def formatted_signers
26
27
  signers.each_with_index.each_with_object({}) do |(signer, i), parameter|
27
- parameter[i] = {
28
+ parameter[i + 1] = {
28
29
  name: signer[:name],
29
30
  email_address: signer[:email_address],
30
31
  order: i
@@ -38,6 +39,10 @@ module HelloSign
38
39
  end
39
40
  end
40
41
 
42
+ def formatted_form_fields_per_document
43
+ form_fields_per_document.to_json
44
+ end
45
+
41
46
  def signers
42
47
  @signers || {}
43
48
  end
@@ -46,6 +51,10 @@ module HelloSign
46
51
  @files || {}
47
52
  end
48
53
 
54
+ def form_fields_per_document
55
+ @form_fields_per_document || []
56
+ end
57
+
49
58
  end
50
59
  end
51
60
  end
@@ -1,3 +1,3 @@
1
1
  module HelloSign
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -36,7 +36,9 @@ describe HelloSign do
36
36
  required: true,
37
37
  signer: 1
38
38
  }
39
- ]
39
+ ],
40
+ [],
41
+ []
40
42
  ]
41
43
 
42
44
  end
@@ -1,5 +1,6 @@
1
1
  require 'helper'
2
2
  require 'hello_sign/parameters/signature_request'
3
+ require 'json'
3
4
 
4
5
  describe HelloSign::Parameters::SignatureRequest do
5
6
  describe "#formatted" do
@@ -15,8 +16,8 @@ describe HelloSign::Parameters::SignatureRequest do
15
16
  message: 'You must sign this.',
16
17
  cc_email_addresses: ['lawyer@lawfirm.com', 'spouse@family.com'],
17
18
  signers: {
18
- 0 => {name: 'Jack', email_address: 'jack@hill.com', order: 0},
19
- 1 => {name: 'Jill', email_address: 'jill@hill.com', order: 1}
19
+ 1 => {name: 'Jack', email_address: 'jack@hill.com', order: 0},
20
+ 2 => {name: 'Jill', email_address: 'jill@hill.com', order: 1}
20
21
  },
21
22
  file: {1 => text_file, 2 => image_file},
22
23
  form_fields_per_document: [
@@ -32,7 +33,7 @@ describe HelloSign::Parameters::SignatureRequest do
32
33
  signer: 1
33
34
  }
34
35
  ]
35
- ]
36
+ ].to_json
36
37
  }
37
38
  end
38
39
 
@@ -89,7 +90,7 @@ describe HelloSign::Parameters::SignatureRequest do
89
90
  cc_email_addresses: nil,
90
91
  signers: {},
91
92
  file: {},
92
- form_fields_per_document: nil
93
+ form_fields_per_document: [].to_json
93
94
  }
94
95
  end
95
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hello_sign
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-13 00:00:00.000000000 Z
12
+ date: 2013-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0.8'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rake
32
48
  requirement: !ruby/object:Gem::Requirement