hellosign-ruby-sdk 3.7.5 → 3.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -2
  3. data/lib/hello_sign.rb +7 -12
  4. data/lib/hello_sign/api.rb +1 -2
  5. data/lib/hello_sign/api/account.rb +17 -30
  6. data/lib/hello_sign/api/api_app.rb +27 -25
  7. data/lib/hello_sign/api/bulk_send_job.rb +62 -0
  8. data/lib/hello_sign/api/embedded.rb +17 -23
  9. data/lib/hello_sign/api/oauth.rb +26 -34
  10. data/lib/hello_sign/api/signature_request.rb +370 -261
  11. data/lib/hello_sign/api/team.rb +21 -26
  12. data/lib/hello_sign/api/template.rb +79 -70
  13. data/lib/hello_sign/api/unclaimed_draft.rb +193 -142
  14. data/lib/hello_sign/client.rb +58 -22
  15. data/lib/hello_sign/configuration.rb +3 -7
  16. data/lib/hello_sign/error.rb +2 -3
  17. data/lib/hello_sign/resource.rb +1 -2
  18. data/lib/hello_sign/resource/account.rb +3 -6
  19. data/lib/hello_sign/resource/api_app.rb +3 -6
  20. data/lib/hello_sign/resource/base_resource.rb +5 -9
  21. data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
  22. data/lib/hello_sign/resource/embedded.rb +7 -10
  23. data/lib/hello_sign/resource/resource_array.rb +7 -10
  24. data/lib/hello_sign/resource/signature_request.rb +6 -9
  25. data/lib/hello_sign/resource/team.rb +3 -6
  26. data/lib/hello_sign/resource/template.rb +5 -8
  27. data/lib/hello_sign/resource/template_draft.rb +4 -7
  28. data/lib/hello_sign/resource/unclaimed_draft.rb +5 -10
  29. data/lib/hello_sign/version.rb +1 -3
  30. data/spec/fixtures/api_app.json +10 -10
  31. data/spec/fixtures/bulk_send_job.json +88 -0
  32. data/spec/fixtures/bulk_send_jobs.json +22 -0
  33. data/spec/hello_sign/api/account_spec.rb +1 -1
  34. data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
  35. data/spec/hello_sign_spec.rb +2 -4
  36. data/spec/spec_helper.rb +0 -2
  37. metadata +11 -3
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,25 +19,23 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
- #
28
25
  # Stores an array of HelloSign BaseResource with paging information
29
26
  #
30
27
  # @author [hellosign]
31
- #
28
+
32
29
  class ResourceArray < Array
33
30
  attr_reader :page, :num_pages, :num_results, :page_size, :warnings, :headers, :list_info, :data
31
+
32
+ # Creates a new ResourceArray from a hash
34
33
  #
35
- # create a new ResourceArray from a hash
36
- #
37
- # @param hash [Hash] Data of the array.
38
- # @param key [String] Key of the hash, point to where resource array data is.
39
- # @param resource_class [Class] a ResourceClass object inherited from BaseResource. Uses the created array item from hash[key].
34
+ # @param hash [Hash] Data of the array.
35
+ # @param key [String] Key of the hash, point to where resource array data is.
36
+ # @param resource_class [Class] a ResourceClass object inherited from BaseResource. Uses the created array item from hash[key].
40
37
  #
41
- # @return [type] [description]
38
+ # @return [HelloSign::Resource::ResourceArray] a ResourceArray
42
39
  def initialize(hash, key, resource_class)
43
40
  @headers = hash[:headers]
44
41
  @data = hash[:body]
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,24 +19,22 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
- #
28
- # Contains information regarding documents that need to be signed.
29
- # Take a look at our API Documentation for sending Signature Requests (https://app.hellosign.com/api/reference#SignatureRequest)
25
+ # Contains information about a SignatureRequest.
26
+ # Take a look at our API Documentation for Signature Requests (https://app.hellosign.com/api/reference#SignatureRequest)
30
27
  # for more information about this.
31
28
  #
32
29
  # @author [hellosign]
33
- #
30
+
34
31
  class SignatureRequest < BaseResource
35
- #
36
- # create a new SignatureRequest from a hash. If a key is defined then account data with be the value of hash[key], otherwise the hash itself.
32
+
33
+ # Creates a new SignatureRequest from a hash. If a key is defined then account data with be the value of hash[key], otherwise the hash itself.
37
34
  # @param hash [Hash] SignatureRequest's data
38
35
  # @param key [String] (signature_request) Key of the hash, point to where SignatureRequest data is. If nil, then the hash itself.
39
36
  #
40
- # @return [HelloSign::Resource::SignatureRequest] a SignatureRequest resource
37
+ # @return [HelloSign::Resource::SignatureRequest] a SignatureRequest
41
38
  def initialize(hash, key='signature_request')
42
39
  super
43
40
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,24 +19,22 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
- #
28
25
  # Contains information about a Team and its members.
29
26
  # Take a look at our API Documentation on the Team Resource (https://app.hellosign.com/api/reference#Team)
30
27
  # for more information about this.
31
28
  #
32
29
  # @author [hellosign]
33
- #
30
+
34
31
  class Team < BaseResource
35
- #
32
+
36
33
  # Creates a new Team from a hash. If a key is defined then team data with be the value of hash[key], otherwise the hash itself.
37
34
  # @param hash [Hash] Team's data
38
35
  # @param key [String] (team) Key of the hash, point to where Team data is. If nil, then the hash itself.
39
36
  #
40
- # @return [HelloSign::Resource:Team] a Team resource
37
+ # @return [HelloSign::Resource::Team] a Team
41
38
  def initialize(hash, key='team')
42
39
  super
43
40
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,24 +19,22 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
- #
28
- # Contains information about the templates you and your team have created
25
+ # Contains information about Templates.
29
26
  # Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
30
27
  # for more information about this.
31
28
  #
32
29
  # @author [hellosign]
33
- #
30
+
34
31
  class Template < BaseResource
35
- #
36
- # Creates a new Template from a hash. If a key is defined then template data will be the value of hash[key], otherwise the hash itself.
32
+
33
+ # Creates a new Template from a hash. If a key is defined then Template data will be the value of hash[key], otherwise the hash itself.
37
34
  # @param hash [Hash] Template's data
38
35
  # @param key [String] (template) Key of the hash, point to where Template data is. If nil, then the hash itself.
39
36
  #
40
- # @return [HelloSign::Resource:Team] a Template resource
37
+ # @return [HelloSign::Resource::Template] a Template
41
38
  def initialize(hash, key='template')
42
39
  super
43
40
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,24 +19,22 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
- #
28
- # A group of documents that a user can take ownership of by going to the claim_url.
25
+ # Contains information about a TemplateDraft.
29
26
  # Take a look at our API Documentation for Templates (https://app.hellosign.com/api/reference#Template)
30
27
  # for more information about this.
31
28
  #
32
29
  # @author [hellosign]
33
- #
30
+
34
31
  class TemplateDraft < BaseResource
35
- #
32
+
36
33
  # Creates a new TemplateDraft from a hash. If a key is defined then TemplateDraft data will be the value of hash[key], otherwise the hash itself.
37
34
  # @param hash [Hash] TemplateDraft's data
38
35
  # @param key [String] (template_draft) Key of the hash, point to where TemplateDraft data is. If nil, then the hash itself.
39
36
  #
40
- # @return [HelloSign::Resource:Team] a Team resource
37
+ # @return [HelloSign::Resource::TemplateDraft] a TemplateDraft
41
38
  def initialize(hash, key='template')
42
39
  super
43
40
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,26 +19,22 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
24
  module Resource
27
-
28
- #
29
- # A group of documents that a user can take ownership of by going to the claim_url.
30
- # Take a look at our API documentation for creating UnclaimedDrafts (https://app.hellosign.com/api/reference#UnclaimedDraft)
25
+ # Contains information about an UnclaimedDraft.
26
+ # Take a look at our API documentation for the UnclaimedDraft resource (https://app.hellosign.com/api/reference#UnclaimedDraft)
31
27
  # for more information about this.
32
28
  #
33
29
  # @author [hellosign]
34
- #
30
+
35
31
  class UnclaimedDraft < BaseResource
36
32
 
37
- #
38
- # create a new UnclaimedDraft from a hash. If a key is defined then UnclaimedDraft data with be the value of hash[key], otherwise the hash itself.
33
+ # Creates a new UnclaimedDraft from a hash. If a key is defined then UnclaimedDraft data with be the value of hash[key], otherwise the hash itself.
39
34
  # @param hash [Hash] UnclaimedDraft's data
40
35
  # @param key [String] (unclaimed_draft) Key of the hash, point to where UnclaimedDraft data is. If nil, then the hash itself.
41
36
  #
42
- # @return [HelloSign::Resource:Team] an UnclaimedDraft resource
37
+ # @return [HelloSign::Resource::UnclaimedDraft] an UnclaimedDraft
43
38
  def initialize(hash, key='unclaimed_draft')
44
39
  super
45
40
  end
@@ -1,4 +1,3 @@
1
- #
2
1
  # The MIT License (MIT)
3
2
  #
4
3
  # Copyright (C) 2014 hellosign.com
@@ -20,8 +19,7 @@
20
19
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
21
  # SOFTWARE.
23
- #
24
22
 
25
23
  module HelloSign
26
- VERSION = '3.7.5'
24
+ VERSION = '3.7.6'
27
25
  end
@@ -1,16 +1,16 @@
1
1
  {
2
2
 
3
3
  "api_app": {
4
- "client_id" : "5e365c014bea2e9a05a9d0834f3e7ca4",
5
- "created_at" : 1438030211,
6
- "name" : "Hodor",
7
- "domain" : "hodor.com",
8
- "callback_url" : null,
9
- "owner_account" : {
10
- "account_id" : "626e28a7781d6d12bd830220488a45e9ef3378ab",
11
- "email_address" : "hello@example.com"
4
+ "client_id": "5e365c014bea2e9a05a9d0834f3e7ca4",
5
+ "created_at": 1438030211,
6
+ "name": "Hodor",
7
+ "domain": "hodor.com",
8
+ "callback_url": null,
9
+ "owner_account": {
10
+ "account_id": "626e28a7781d6d12bd830220488a45e9ef3378ab",
11
+ "email_address": "hello@example.com"
12
12
  },
13
- "is_approved" : false,
14
- "oauth" : null
13
+ "is_approved": false,
14
+ "oauth": null
15
15
  }
16
16
  }
@@ -0,0 +1,88 @@
1
+ {
2
+ "bulk_send_job": {
3
+ "bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab",
4
+ "total": 3,
5
+ "is_creator": true,
6
+ "created_at": 1536784104
7
+ },
8
+ "list_info": {
9
+ "page": 1,
10
+ "num_pages": 1,
11
+ "num_results": 2,
12
+ "page_size": 20
13
+ },
14
+ "signature_requests": [
15
+ {
16
+ "signature_request_id": "76cdec91655d6b26e403e8c10c1def40c26510ok",
17
+ "test_mode": true,
18
+ "title": "Please sign",
19
+ "original_title": "Please sign",
20
+ "subject": "This requires your signature",
21
+ "message": null,
22
+ "metadata": {},
23
+ "is_complete": false,
24
+ "is_declined": false,
25
+ "has_error": false,
26
+ "custom_fields": [],
27
+ "response_data": [],
28
+ "signing_url": "https://app.hellosign.com/sign/76cdec91655d6b26e403e8c10c1def40c26510ok",
29
+ "signing_redirect_url": null,
30
+ "final_copy_uri": "/v3/signature_request/final_copy/76cdec91655d6b26e403e8c10c1def40c26510ok",
31
+ "files_url": "https://api.hellosign.com/v3/signature_request/files/76cdec91655d6b26e403e8c10c1def40c26510ok",
32
+ "details_url": "https://app.hellosign.com/home/manage?guid=76cdec91655d6b26e403e8c10c1def40c26510ok",
33
+ "requester_email_address": "requester@example.com",
34
+ "signatures": [
35
+ {
36
+ "signature_id": "1ccd835c064c4d7936012840924c0528",
37
+ "has_pin": false,
38
+ "signer_email_address": "bulksend1@example.com",
39
+ "signer_name": "George Signer",
40
+ "order": null,
41
+ "status_code": "signed",
42
+ "signed_at": 1542665401,
43
+ "last_viewed_at": 1542665391,
44
+ "last_reminded_at": null,
45
+ "error": null
46
+ }
47
+ ],
48
+ "cc_email_addresses": [],
49
+ "bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab"
50
+ },
51
+ {
52
+ "signature_request_id": "b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
53
+ "test_mode": true,
54
+ "title": "Please sign",
55
+ "original_title": "Please sign",
56
+ "subject": "This requires your signature",
57
+ "message": null,
58
+ "metadata": {},
59
+ "is_complete": false,
60
+ "is_declined": false,
61
+ "has_error": false,
62
+ "custom_fields": [],
63
+ "response_data": [],
64
+ "signing_url": "https://app.hellosign.com/sign/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
65
+ "signing_redirect_url": null,
66
+ "final_copy_uri": "/v3/signature_request/final_copy/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
67
+ "files_url": "https://api.hellosign.com/v3/signature_request/files/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
68
+ "details_url": "https://app.hellosign.com/home/manage?guid=b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
69
+ "requester_email_address": "requester@example.com",
70
+ "signatures": [
71
+ {
72
+ "signature_id": "2ad95d666374efcfb2bf299855591738",
73
+ "has_pin": false,
74
+ "signer_email_address": "bulksend2@example.com",
75
+ "signer_name": "Mary Signer",
76
+ "order": null,
77
+ "status_code": "awaiting_signature",
78
+ "signed_at": null,
79
+ "last_viewed_at": null,
80
+ "last_reminded_at": null,
81
+ "error": null
82
+ }
83
+ ],
84
+ "cc_email_addresses": [],
85
+ "bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab"
86
+ }
87
+ ]
88
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "list_info": {
3
+ "page": 1,
4
+ "num_pages": 1,
5
+ "num_results": 2,
6
+ "page_size": 20
7
+ },
8
+ "bulk_send_jobs": [
9
+ {
10
+ "bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab",
11
+ "total": 2,
12
+ "is_creator": true,
13
+ "created_at": 1542664362
14
+ },
15
+ {
16
+ "bulk_send_job_id": "d74f731b24b00fe6a61083bcff11d0aepl5bf927",
17
+ "total": 3,
18
+ "is_creator": true,
19
+ "created_at": 1542655564
20
+ }
21
+ ]
22
+ }
@@ -23,7 +23,7 @@ describe HelloSign::Api::Account do
23
23
  describe '#create_account' do
24
24
  before do
25
25
  stub_post('/account/create', 'account')
26
- @body = { :email_address => 'test@example.com' }
26
+ @body = { email_address: 'test@example.com' }
27
27
  @account = HelloSign.create_account @body
28
28
  end
29
29
 
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Api::BulkSendJob do
4
+ describe '#get_bulk_send_job' do
5
+ before do
6
+ stub_get('/bulk_send_job/1', 'bulk_send_job')
7
+ @bulk_send = HelloSign.get_bulk_send_job :bulk_send_job_id => 1
8
+ end
9
+
10
+ it 'should get the correct resource' do
11
+ expect(a_get('/bulk_send_job/1')).to have_been_made
12
+ end
13
+
14
+ it 'should return response headers' do
15
+ expect(@bulk_send.headers).to_not be_nil
16
+ end
17
+
18
+ it 'should return a Bulk Send Job' do
19
+ expect(@bulk_send).to be_an HelloSign::Resource::BulkSendJob
20
+ end
21
+ end
22
+
23
+ describe '#get_bulk_send_jobs' do
24
+ before do
25
+ stub_get('/bulk_send_job/list', 'bulk_send_jobs')
26
+ @bulk_send_jobs = HelloSign.get_bulk_send_jobs({})
27
+ end
28
+
29
+ it 'should get the correct resource' do
30
+ expect(a_get('/bulk_send_job/list')).to have_been_made
31
+ end
32
+
33
+ it 'returns reponse headers' do
34
+ expect(@bulk_send_jobs.headers).to_not be_nil
35
+ end
36
+
37
+ it 'should return a ResourceArray' do
38
+ expect(@bulk_send_jobs).to be_an HelloSign::Resource::ResourceArray
39
+ end
40
+
41
+ it 'each of Array is a BulkSendJob' do
42
+ expect(@bulk_send_jobs[0]).to be_an HelloSign::Resource::BulkSendJob
43
+ end
44
+
45
+ it 'should return list_info as a BaseResource in results' do
46
+ expect(@bulk_send_jobs[0].list_info).to be_an HelloSign::Resource::BaseResource
47
+ end
48
+
49
+ it 'should return page numbers as an integer' do
50
+ expect(@bulk_send_jobs[0].list_info.page).to be_an Integer
51
+ end
52
+ end
53
+ end
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- #
4
3
  # The MIT License (MIT)
5
- #
4
+ #
6
5
  # Copyright (C) 2014 hellosign.com
7
- #
6
+ #
8
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
9
8
  # of this software and associated documentation files (the "Software"), to deal
10
9
  # in the Software without restriction, including without limitation the rights
@@ -22,7 +21,6 @@ require 'spec_helper'
22
21
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
23
  # SOFTWARE.
25
- #
26
24
 
27
25
  describe HelloSign do
28
26
  after { HelloSign.reset }