hello_sign 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,8 @@ module HelloSign
33
33
  private
34
34
 
35
35
  def credentials_match?
36
- @client && client_credentials.hash == provided_credentials.hash
36
+ instance_variable_defined?(:@client) &&
37
+ client_credentials.hash == provided_credentials.hash
37
38
  end
38
39
 
39
40
  def client_credentials
@@ -5,7 +5,8 @@ module HelloSign
5
5
  class File
6
6
  DEFAULT_MIME_TYPE = MIME_TYPES.fetch('txt')
7
7
 
8
- attr_reader :filename, :io_object, :mime_type
8
+ attr_reader :filename, :io_object
9
+ private :filename, :io_object
9
10
 
10
11
  def initialize(file_data)
11
12
  @filename = file_data[:filename]
@@ -1,8 +1,10 @@
1
1
  module HelloSign
2
2
  module Parameters
3
3
  class ReusableFormSignatureRequest
4
- attr_writer :reusable_form_id, :title, :subject, :message, :ccs, :signers,
5
- :custom_fields
4
+ attr_accessor :reusable_form_id, :title, :subject, :message
5
+ private :reusable_form_id, :title, :subject, :message
6
+
7
+ attr_writer :ccs, :signers, :custom_fields
6
8
 
7
9
  def formatted
8
10
  {
@@ -18,8 +20,6 @@ module HelloSign
18
20
 
19
21
  private
20
22
 
21
- attr_reader :reusable_form_id, :title, :subject, :message
22
-
23
23
  def formatted_ccs
24
24
  ccs.each_with_object({}) do |cc, parameter|
25
25
  parameter[cc[:role]] = {email_address: cc[:email_address]}
@@ -3,23 +3,25 @@ require 'hello_sign/file'
3
3
  module HelloSign
4
4
  module Parameters
5
5
  class SignatureRequest
6
- attr_writer :title, :subject, :message, :ccs, :signers, :files
6
+ attr_accessor :title, :subject, :message, :ccs, :form_fields_per_document
7
+ private :title, :subject, :message, :ccs, :form_fields_per_document
8
+
9
+ attr_writer :signers, :files
7
10
 
8
11
  def formatted
9
12
  {
10
- title: title,
11
- subject: subject,
12
- message: message,
13
- cc_email_addresses: ccs,
14
- signers: formatted_signers,
15
- file: formatted_files
13
+ title: title,
14
+ subject: subject,
15
+ message: message,
16
+ cc_email_addresses: ccs,
17
+ signers: formatted_signers,
18
+ file: formatted_files,
19
+ form_fields_per_document: form_fields_per_document
16
20
  }
17
21
  end
18
22
 
19
23
  private
20
24
 
21
- attr_reader :title, :subject, :message, :ccs
22
-
23
25
  def formatted_signers
24
26
  signers.each_with_index.each_with_object({}) do |(signer, i), parameter|
25
27
  parameter[i] = {
@@ -1,5 +1,3 @@
1
- require 'hello_sign/client'
2
-
3
1
  module HelloSign
4
2
  module Proxy
5
3
  class Settings
@@ -1,3 +1,3 @@
1
1
  module HelloSign
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -24,6 +24,21 @@ describe HelloSign do
24
24
  {filename: 'spec/fixtures/test.jpg'},
25
25
  {io: image_io, mime: 'image/jpeg'}
26
26
  ]
27
+ request.form_fields_per_document = [
28
+ [],
29
+ [
30
+ {
31
+ type: 'text',
32
+ x: 112,
33
+ y: 328,
34
+ width: 100,
35
+ height: 16,
36
+ required: true,
37
+ signer: 1
38
+ }
39
+ ]
40
+ ]
41
+
27
42
  end
28
43
 
29
44
  expect(a_post_with_auth('/signature_request/send')
@@ -10,6 +10,12 @@ describe HelloSign do
10
10
  HelloSign.password = password
11
11
  end
12
12
 
13
+ after do
14
+ if HelloSign.instance_variable_defined?(:@client)
15
+ HelloSign.send(:remove_instance_variable, :@client)
16
+ end
17
+ end
18
+
13
19
  describe "::client" do
14
20
  let(:client) { double('client') }
15
21
 
@@ -36,8 +42,6 @@ describe HelloSign do
36
42
  HelloSign.client
37
43
  end
38
44
 
39
- after { HelloSign.instance_variable_set(:@client, nil) }
40
-
41
45
  its(:client) { should be client }
42
46
 
43
47
  context "and the credentials change" do
@@ -56,8 +60,6 @@ describe HelloSign do
56
60
 
57
61
  before { allow(HelloSign::Client).to receive(:new).and_return(client) }
58
62
 
59
- after { HelloSign.instance_variable_set(:@client, nil) }
60
-
61
63
  describe "::account" do
62
64
  before do
63
65
  allow(client).to receive(:account)
@@ -36,7 +36,7 @@ describe HelloSign::Middleware::RaiseError do
36
36
  ).merge(response_headers)
37
37
  )
38
38
  rescue HelloSign::Error::BadRequest => e
39
- expect("#{e}").to match /#{Regexp.escape("[Status code: 418] I'm a teapot")}/
39
+ expect("#{e}").to match(/#{Regexp.escape("[Status code: 418] I'm a teapot")}/)
40
40
  end
41
41
  end
42
42
  end
@@ -18,7 +18,21 @@ describe HelloSign::Parameters::SignatureRequest do
18
18
  0 => {name: 'Jack', email_address: 'jack@hill.com', order: 0},
19
19
  1 => {name: 'Jill', email_address: 'jill@hill.com', order: 1}
20
20
  },
21
- file: {1 => text_file, 2 => image_file}
21
+ file: {1 => text_file, 2 => image_file},
22
+ form_fields_per_document: [
23
+ [],
24
+ [
25
+ {
26
+ type: 'text',
27
+ x: 112,
28
+ y: 328,
29
+ width: 100,
30
+ height: 16,
31
+ required: true,
32
+ signer: 1
33
+ }
34
+ ]
35
+ ]
22
36
  }
23
37
  end
24
38
 
@@ -35,6 +49,20 @@ describe HelloSign::Parameters::SignatureRequest do
35
49
  @file_data_1 = {filename: 'test.txt', io: 'text file IO object', mime: 'text/plain'},
36
50
  @file_data_2 = {filename: 'test.jpg', io: 'image file IO object', mime: 'image/jpeg'}
37
51
  ]
52
+ request_parameters.form_fields_per_document = [
53
+ [],
54
+ [
55
+ {
56
+ type: 'text',
57
+ x: 112,
58
+ y: 328,
59
+ width: 100,
60
+ height: 16,
61
+ required: true,
62
+ signer: 1
63
+ }
64
+ ]
65
+ ]
38
66
 
39
67
  allow(HelloSign::File).to(
40
68
  receive(:new).with(@file_data_1).and_return(text_file)
@@ -55,12 +83,13 @@ describe HelloSign::Parameters::SignatureRequest do
55
83
  context "when required parameters are omitted" do
56
84
  let(:expected) do
57
85
  {
58
- title: nil,
59
- subject: nil,
60
- message: nil,
61
- cc_email_addresses: nil,
62
- signers: {},
63
- file: {}
86
+ title: nil,
87
+ subject: nil,
88
+ message: nil,
89
+ cc_email_addresses: nil,
90
+ signers: {},
91
+ file: {},
92
+ form_fields_per_document: nil
64
93
  }
65
94
  end
66
95
 
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.1.1
4
+ version: 1.2.0
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-06 00:00:00.000000000 Z
12
+ date: 2013-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -32,17 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '10.0'
37
+ version: '0'
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: '10.0'
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rspec
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ files:
130
130
  - spec/unit/proxy/team_spec.rb
131
131
  - spec/unit/proxy/unclaimed_draft_spec.rb
132
132
  - spec/unit/upload_io_spec.rb
133
- homepage: http://www.github.com/craiglittle/hello_sign
133
+ homepage: https://github.com/craiglittle/hello_sign
134
134
  licenses:
135
135
  - MIT
136
136
  post_install_message:
@@ -143,18 +143,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  - - ! '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
- segments:
147
- - 0
148
- hash: 1499078184543381550
149
146
  required_rubygems_version: !ruby/object:Gem::Requirement
150
147
  none: false
151
148
  requirements:
152
149
  - - ! '>='
153
150
  - !ruby/object:Gem::Version
154
151
  version: '0'
155
- segments:
156
- - 0
157
- hash: 1499078184543381550
158
152
  requirements: []
159
153
  rubyforge_project:
160
154
  rubygems_version: 1.8.25
@@ -191,3 +185,4 @@ test_files:
191
185
  - spec/unit/proxy/team_spec.rb
192
186
  - spec/unit/proxy/unclaimed_draft_spec.rb
193
187
  - spec/unit/upload_io_spec.rb
188
+ has_rdoc: