hellosign-ruby-sdk 3.0.9 → 3.0.10

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.
data/README.md CHANGED
@@ -26,8 +26,6 @@ HelloSign.configure do |config|
26
26
  # If api_key, email_address and password are all present, api_key will be used
27
27
  # config.email_address = 'email_address'
28
28
  # config.password = 'password'
29
- config.client_id = 'your_client_id' #required only when you want to use embedded or OAuth
30
- config.client_secret = 'your_client_secret' #required only when you want to use OAuth
31
29
  end
32
30
  ```
33
31
 
@@ -22,6 +22,17 @@ module HelloSign
22
22
  def get_embedded_sign_url(opts)
23
23
  HelloSign::Resource::Embedded.new get("/embedded/sign_url/#{opts[:signature_id]}")
24
24
  end
25
+ #
26
+ # Retrieves the edit url for an embedded template.
27
+ # @option opts [String] template_id The id of the template to get a edit url for
28
+ #
29
+ # @return [HelloSign::Resource::Embedded] Returns an Embedded object
30
+ # @example
31
+ # edit_url = @client.get_embedded_template_edit_url :template_id => '39e3387f738adfa7ddd4cbd4c00d2a8ab6e4194b'
32
+ #
33
+ def get_embedded_template_edit_url(opts)
34
+ HelloSign::Resource::Embedded.new get("/embedded/edit_url/#{opts[:template_id]}")
35
+ end
25
36
  end
26
37
  end
27
38
  end
@@ -23,6 +23,17 @@ module HelloSign
23
23
  HelloSign::Resource::Template.new get("/template/#{opts[:template_id]}")
24
24
  end
25
25
 
26
+ #
27
+ # Deletes the Template specified by the id parameter.
28
+ # @option opts [String] template_id The id of the Template to delete.
29
+ ##
30
+ # @example
31
+ # template = @client.get_template :template_id => 'f57db65d3f933b5316d398057a36176831451a35'
32
+ #
33
+ def delete_template(opts)
34
+ post("/template/#{opts[:template_id]}")
35
+ end
36
+
26
37
  #
27
38
  # Retrieves the Templates for the current user account.
28
39
  #
@@ -71,6 +82,56 @@ module HelloSign
71
82
  opts.delete(:template_id)
72
83
  HelloSign::Resource::Template.new post(path, :body => opts)
73
84
  end
85
+
86
+ #
87
+ # Creates a new embedded template draft object that can be launched in an iframe using the claim URL.
88
+ # @option opts [Integer] test_mode (0) Whether this is a test, the signature request will not be legally binding if set to 1.
89
+ # @option opts [Array<String>] files Use files to indicate the uploaded file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.
90
+ # @option opts [Array<String>] file_urls Use file_urls to have HelloSign download the file(s) to send for signature. Currently we only support use of either the files parameter or file_urls parameter, not both.
91
+ # @option opts [String] title The default template email subject.
92
+ # @option opts [String] subject The subject in the email that will be sent to the signers.
93
+ # @option opts [String] requester_email_address The email address of the requester.
94
+ # @option opts [String] message The custom message in the email that will be sent to the signers.
95
+ # @option opts [Array<Hash>] signers List of signer_roles, each item is a Hash with these keys:
96
+ # * :name (String) signer's role name
97
+ # * :order (Integer) The order the signer is required to sign in (optional)
98
+ # @option opts [Array<Hash>] cc_roles The email addresses CC roles. Will mean the CC role will be Required when sending the template.
99
+ # @option opts [Array<Hash>] merge_fields List of fields that can be pre-populated by your application when using the resulting template to send a signature request
100
+ # * :name (String) merge field name
101
+ # * :type (String) <text|checkbox>
102
+ #
103
+ # @example create_embedded_draft
104
+ # template_draft = @client.create_embedded_template_draft(
105
+ # :test_mode => 1,
106
+ # :subject => 'The NDA we talked about',
107
+ # :requester_email_address => requester@example.com",
108
+ # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
109
+ # :signer_roles => [{
110
+ # :name => 'Manager',
111
+ # :order => 0
112
+ # },{
113
+ # :name => 'Client',
114
+ # :order => 1
115
+ # }
116
+ # ],
117
+ # :cc_roles => ['HRManager'],
118
+ # :files => ['NDA.pdf', 'AppendixA.pdf'],
119
+ # :merge_fields => '[{
120
+ # :name => 'contract_id',
121
+ # :type => 'text'
122
+ # },{
123
+ # :name => 'purchase_price',
124
+ # :order => 'text'
125
+ # }
126
+ # ]'
127
+ # )
128
+ #
129
+ def create_embedded_template_draft(opts)
130
+ opts[:client_id] ||= self.client_id
131
+ prepare_files opts
132
+ prepare_signer_roles opts
133
+ HelloSign::Resource::TemplateDraft.new post("/template/create_embedded_draft", :body => opts)
134
+ end
74
135
  end
75
136
  end
76
137
  end
@@ -128,6 +128,61 @@ module HelloSign
128
128
 
129
129
  HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded', :body => opts)
130
130
  end
131
+
132
+
133
+ #
134
+ # Creates a new embedded unclaimed draft object from a template that can be launched in an iframe using the claim URL.
135
+ # @option opts [Integer] test_mode (0) Whether this is a test, the signature request will not be legally binding if set to 1.
136
+ # @option opts [String] subject The subject in the email that will be sent to the signers.
137
+ # @option opts [String] requester_email_address The email address of the requester.
138
+ # @option opts [String] message The custom message in the email that will be sent to the signers.
139
+ # @option opts [String] signing_redirect_url The URL you want the signer redirected to after they successfully sign. (optional)
140
+ #
141
+ # @option opts [Array<Hash>] signers List of signers, each item is a Hash with these keys:
142
+ # * :name (String) Sender' name
143
+ # * :email_address (String) Sender's email address
144
+ # * :order (Integer) The order the signer is required to sign in (optional)
145
+ # * :pin (Integer) The 4-digit code that will secure this signer's signature page. You must have a business plan to use this feature. (optional)
146
+ # @option opts [Array<String>] cc_email_addresses The email addresses that should be CCed.
147
+ #
148
+ # @return [HelloSign::Resource::UnclaimedDraft] a UnclaimedDraft object
149
+ #
150
+ # @example request_signature
151
+ # unclaimed_draft = @client.create_embedded_unclaimed_draft_with_template(
152
+ # :test_mode => 1,
153
+ # :subject => 'The NDA we talked about',
154
+ # :template_id => 'c26b8a16784a872da37ea946b9ddec7c1e11dff6',
155
+ # :requester_email_address => requester@example.com",
156
+ # :message => 'Please sign this NDA and then we can discuss more. Let me know if you have any questions.',
157
+ # :metadata => {
158
+ # :client_id => '1234',
159
+ # :custom_text => 'NDA #9'
160
+ # },
161
+ # :signers => [
162
+ # {
163
+ # :email_address => 'george@example.com',
164
+ # :name => 'George',
165
+ # :role => 'Client'
166
+ # }
167
+ # ],
168
+ # :ccs => [
169
+ # {
170
+ # :email_address =>'accounting@example.com',
171
+ # :role => "Accounting"
172
+ # }
173
+ # ],
174
+ # :custom_fields => {
175
+ # :Cost => '$20,000'
176
+ # }
177
+ # )
178
+ #
179
+ def create_embedded_unclaimed_draft_with_template(opts)
180
+ opts[:client_id] ||= self.client_id
181
+ prepare_signers opts
182
+ prepare_ccs opts
183
+ prepare_templates opts
184
+ HelloSign::Resource::UnclaimedDraft.new post('/unclaimed_draft/create_embedded_with_template', :body => opts)
185
+ end
131
186
  end
132
187
  end
133
188
  end
@@ -152,7 +152,7 @@ module HelloSign
152
152
  elsif response.body.strip.empty?
153
153
  {}
154
154
  else
155
- MultiJson.load response.body
155
+ MultiJson.load response.body.strip
156
156
  end
157
157
  end
158
158
 
@@ -196,6 +196,14 @@ module HelloSign
196
196
  prepare opts, :template_ids
197
197
  end
198
198
 
199
+ def prepare_cc_roles(opts)
200
+ prepare opts, :merge_fields
201
+ end
202
+
203
+ def prepare_signer_roles(opts)
204
+ prepare opts, :signer_roles
205
+ end
206
+
199
207
  def prepare(opts, key)
200
208
  return unless opts[key]
201
209
  opts[key].each_with_index do |value, index|
@@ -1,5 +1,6 @@
1
1
  require 'hello_sign/resource/base_resource'
2
2
  require 'hello_sign/resource/resource_array'
3
+ require 'hello_sign/resource/template_draft'
3
4
  require 'hello_sign/resource/account'
4
5
  require 'hello_sign/resource/embedded'
5
6
  require 'hello_sign/resource/template'
@@ -0,0 +1,25 @@
1
+ module HelloSign
2
+ module Resource
3
+
4
+ #
5
+ # A group of documents that a user can take ownership of by going to the claim URL
6
+ # Take a look at our {https://www.hellosign.com/api/reference}
7
+ # for more information about this.
8
+ #
9
+ # @author [hellosign]
10
+ #
11
+ class TemplateDraft < BaseResource
12
+
13
+ #
14
+ # create a new TemplateDraft from a hash. If a key is defined then template draft data will be the value of hash[key], otherwise the hash itself
15
+ # @param hash [Hash] template draft's data
16
+ # @param key [String] (template_draft) key of the hash, point to where template draft data is. If nil then the hash itself
17
+ #
18
+ # @return [HelloSign::Resource:Team] a Team resource
19
+ def initialize(hash, key='template')
20
+ super
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module HelloSign
2
- VERSION = '3.0.9'
2
+ VERSION = '3.0.10'
3
3
  end
metadata CHANGED
@@ -1,97 +1,110 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hellosign-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.0.10
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - HelloSign
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
12
+ date: 2015-04-13 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '1.5'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.5'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: webmock
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: faraday
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - ">="
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - ">="
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: multi_json
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - ">="
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - ">="
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  description: ''
@@ -100,9 +113,9 @@ executables: []
100
113
  extensions: []
101
114
  extra_rdoc_files: []
102
115
  files:
103
- - ".gitignore"
104
- - ".rspec"
105
- - ".travis.yml"
116
+ - .gitignore
117
+ - .rspec
118
+ - .travis.yml
106
119
  - Gemfile
107
120
  - Guardfile
108
121
  - LICENSE.txt
@@ -129,6 +142,7 @@ files:
129
142
  - lib/hello_sign/resource/signature_request.rb
130
143
  - lib/hello_sign/resource/team.rb
131
144
  - lib/hello_sign/resource/template.rb
145
+ - lib/hello_sign/resource/template_draft.rb
132
146
  - lib/hello_sign/resource/unclaimed_draft.rb
133
147
  - lib/hello_sign/version.rb
134
148
  - spec/fixtures/account.json
@@ -156,26 +170,27 @@ files:
156
170
  homepage: http://www.hellosign.com
157
171
  licenses:
158
172
  - MIT
159
- metadata: {}
160
173
  post_install_message:
161
174
  rdoc_options: []
162
175
  require_paths:
163
176
  - lib
164
177
  required_ruby_version: !ruby/object:Gem::Requirement
178
+ none: false
165
179
  requirements:
166
- - - ">="
180
+ - - ! '>='
167
181
  - !ruby/object:Gem::Version
168
182
  version: '0'
169
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
+ none: false
170
185
  requirements:
171
- - - ">="
186
+ - - ! '>='
172
187
  - !ruby/object:Gem::Version
173
188
  version: '0'
174
189
  requirements: []
175
190
  rubyforge_project:
176
- rubygems_version: 2.2.2
191
+ rubygems_version: 1.8.23
177
192
  signing_key:
178
- specification_version: 4
193
+ specification_version: 3
179
194
  summary: A Ruby SDK for the HelloSign API.
180
195
  test_files:
181
196
  - spec/fixtures/account.json
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 9d25f5b018fddb236b999be3180ac75d09f8ac88
4
- data.tar.gz: d999948d08a67e479010c86df94981e4d202179c
5
- SHA512:
6
- metadata.gz: b201a69a221b32e13f5d0c6874a885fb5ab1d84fc396f0a059704249cd4945976127994625172fef21f5781f653c79a1aca62615a326712a84b5fbff720e5375
7
- data.tar.gz: 6ae74ea3cd74e11da0346f8c4373181120dac9317221eb51f9257b50d96d0eaed8e3619f31155a26f989e677c95ab4be9eb9f8ede74d4fc960818d6b5f75954f