hellosign-ruby-sdk 3.0.3 → 3.0.4

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.
Files changed (38) hide show
  1. data/README.md +1 -2
  2. data/Rakefile +2 -2
  3. data/hellosign-ruby-sdk.gemspec +8 -8
  4. data/lib/hello_sign.rb +1 -1
  5. data/lib/hello_sign/api/account.rb +7 -10
  6. data/lib/hello_sign/api/embedded.rb +1 -1
  7. data/lib/hello_sign/api/oauth.rb +7 -9
  8. data/lib/hello_sign/api/signature_request.rb +10 -10
  9. data/lib/hello_sign/api/team.rb +10 -10
  10. data/lib/hello_sign/api/template.rb +6 -7
  11. data/lib/hello_sign/api/unclaimed_draft.rb +2 -4
  12. data/lib/hello_sign/client.rb +11 -11
  13. data/lib/hello_sign/configuration.rb +1 -2
  14. data/lib/hello_sign/resource/base_resource.rb +1 -3
  15. data/lib/hello_sign/resource/resource_array.rb +2 -3
  16. data/lib/hello_sign/resource/template.rb +0 -1
  17. data/lib/hello_sign/version.rb +1 -1
  18. data/spec/fixtures/account.json +15 -1
  19. data/spec/fixtures/error.json +5 -5
  20. data/spec/fixtures/signature_request.json +38 -2
  21. data/spec/fixtures/signature_requests.json +43 -13
  22. data/spec/fixtures/team.json +14 -18
  23. data/spec/fixtures/template.json +53 -1
  24. data/spec/fixtures/templates.json +58 -10
  25. data/spec/fixtures/token.json +13 -13
  26. data/spec/fixtures/unclaimed_draft.json +5 -5
  27. data/spec/hello_sign/api/account_spec.rb +13 -15
  28. data/spec/hello_sign/api/embedded_spec.rb +4 -4
  29. data/spec/hello_sign/api/oauth_spec.rb +9 -10
  30. data/spec/hello_sign/api/signature_request_spec.rb +43 -44
  31. data/spec/hello_sign/api/team_spec.rb +37 -39
  32. data/spec/hello_sign/api/template_spec.rb +21 -21
  33. data/spec/hello_sign/api/unclaimed_draft_spec.rb +13 -13
  34. data/spec/hello_sign/client_spec.rb +50 -51
  35. data/spec/hello_sign/resource/base_resource_spec.rb +18 -16
  36. data/spec/hello_sign_spec.rb +7 -7
  37. data/spec/spec_helper.rb +0 -1
  38. metadata +3 -3
@@ -1,6 +1,5 @@
1
1
  module HelloSign
2
2
 
3
-
4
3
  #
5
4
  # Define config attributes and default values for HelloSign module
6
5
  #
@@ -9,7 +8,7 @@ module HelloSign
9
8
  module Configuration
10
9
  DEFAULT_ENDPOINT = 'https://api.hellosign.com'
11
10
  DEFAULT_API_VERSION = '/v3'
12
- DEFAULT_OAUTH_ENDPOINT = "https://www.hellosign.com"
11
+ DEFAULT_OAUTH_ENDPOINT = 'https://www.hellosign.com'
13
12
  VALID_OPTIONS_KEYS = [:end_point, :oauth_end_point, :api_version, :user_agent, :client_id, :client_secret, :email_address, :password, :api_key, :auth_token, :log_level, :logging]
14
13
 
15
14
 
@@ -8,7 +8,6 @@ module HelloSign
8
8
  #
9
9
  class BaseResource
10
10
 
11
-
12
11
  #
13
12
  # recursively convert hash data into BaseResource.
14
13
  #
@@ -18,7 +17,7 @@ module HelloSign
18
17
  # @return [HelloSign::Resource::BaseResource] a new BaseResource
19
18
  def initialize(hash, key=nil)
20
19
  @raw_data = key ? hash[key] : hash
21
- @data = @raw_data.inject({}) do |data, (key,value)|
20
+ @data = @raw_data.inject({}) do |data, (key, value)|
22
21
  data[key.to_s] = if value.is_a? Hash
23
22
  value = BaseResource.new(value)
24
23
  elsif ((value.is_a? Array) && (value[0].is_a? Hash))
@@ -30,7 +29,6 @@ module HelloSign
30
29
  end
31
30
  end
32
31
 
33
-
34
32
  #
35
33
  # Magic method, give class dynamic methods based on hash keys.
36
34
  #
@@ -9,7 +9,6 @@ module HelloSign
9
9
  class ResourceArray < Array
10
10
  attr_reader :page, :num_pages, :num_results, :page_size
11
11
 
12
-
13
12
  #
14
13
  # create a new ResourceArray from a hash
15
14
  #
@@ -24,8 +23,8 @@ module HelloSign
24
23
  @num_results = hash['list_info']['num_results']
25
24
  @page_size = hash['list_info']['page_size']
26
25
  hash[key] && hash[key].each do |resouce|
27
- self << resource_class.new(resouce, nil)
28
- end
26
+ self << resource_class.new(resouce, nil)
27
+ end
29
28
  end
30
29
  end
31
30
  end
@@ -3,7 +3,6 @@ module HelloSign
3
3
 
4
4
  #
5
5
  # Contains information about the templates you and your team have created
6
- #
7
6
  # Take a look at our {https://www.hellosign.com/api/reference#Template Template resource document}
8
7
  # for more information about this.
9
8
  #
@@ -1,3 +1,3 @@
1
1
  module HelloSign
2
- VERSION = "3.0.3"
2
+ VERSION = '3.0.4'
3
3
  end
@@ -1 +1,15 @@
1
- {"account": {"account_id":"123456789", "email_address":"test@example.com", "is_paid_hs":false, "is_paid_hf":false, "quotas":{"templates_left":0, "documents_left":0, "api_signature_requests_left":0}, "callback_url":"https://example.com", "role_code":""}}
1
+ {
2
+ "account": {
3
+ "account_id": "123456789",
4
+ "email_address": "test@example.com",
5
+ "is_paid_hs": false,
6
+ "is_paid_hf": false,
7
+ "quotas": {
8
+ "templates_left": 0,
9
+ "documents_left": 0,
10
+ "api_signature_requests_left": 0
11
+ },
12
+ "callback_url": "https://example.com",
13
+ "role_code": ""
14
+ }
15
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "error": {
3
- "error_msg": "Error Message",
4
- "error_name": "Error Name"
5
- }
6
- }
2
+ "error": {
3
+ "error_msg": "Error Message",
4
+ "error_name": "Error Name"
5
+ }
6
+ }
@@ -1,2 +1,38 @@
1
- {"signature_request":{"signature_request_id":"1", "title":"title", "original_title":"original_title", "subject":"subject", "message":"message", "test_mode":false, "is_complete":true, "has_error":false, "custom_fields":[],
2
- "response_data":[{"name":"name", "value":"value", "type":"signature", "api_id":"api_id", "signature_id":"signature_id"}], "signing_url":"https://example.com/signing_url", "signing_redirect_url":"https://example.com/signing_redirect_url", "final_copy_uri":"/v3/final_copy_url", "files_url":"https://example.com/file_url", "details_url":"https://example.com/details_url", "requester_email_address":"requester_email_address@example.com", "signatures":[{"signature_id":"signature_id", "has_pin":false, "signer_email_address":"signer_email_address@example.com", "signer_name":"signer_name", "order":1, "status_code":"signed", "signed_at":1393389891, "last_viewed_at":1393389853, "last_reminded_at":1393389852}], "cc_email_addresses":[]}}
1
+ {
2
+ "signature_request": {
3
+ "signature_request_id": "1",
4
+ "title": "title",
5
+ "original_title": "original_title",
6
+ "subject": "subject",
7
+ "message": "message",
8
+ "test_mode": false,
9
+ "is_complete": true,
10
+ "has_error": false,
11
+ "custom_fields": [],
12
+ "response_data": [{
13
+ "name": "name",
14
+ "value": "value",
15
+ "type": "signature",
16
+ "api_id": "api_id",
17
+ "signature_id": "signature_id"
18
+ }],
19
+ "signing_url": "https://example.com/signing_url",
20
+ "signing_redirect_url": "https://example.com/signing_redirect_url",
21
+ "final_copy_uri": "/v3/final_copy_url",
22
+ "files_url": "https://example.com/file_url",
23
+ "details_url": "https://example.com/details_url",
24
+ "requester_email_address": "requester_email_address@example.com",
25
+ "signatures": [{
26
+ "signature_id": "signature_id",
27
+ "has_pin": false,
28
+ "signer_email_address": "signer_email_address@example.com",
29
+ "signer_name": "signer_name",
30
+ "order": 1,
31
+ "status_code": "signed",
32
+ "signed_at": 1393389891,
33
+ "last_viewed_at": 1393389853,
34
+ "last_reminded_at": 1393389852
35
+ }],
36
+ "cc_email_addresses": []
37
+ }
38
+ }
@@ -1,14 +1,44 @@
1
1
  {
2
- "list_info": {
3
- "page": 1,
4
- "num_pages": 1,
5
- "num_results": 1,
6
- "page_size": 20
7
- },
8
- "signature_requests":[
9
- {
10
- "signature_request_id":"1", "title":"title", "original_title":"original_title", "subject":"subject", "message":"message", "test_mode":false, "is_complete":true, "has_error":false, "custom_fields":[],
11
- "response_data":[{"name":"name", "value":"value", "type":"signature", "api_id":"api_id", "signature_id":"signature_id"}], "signing_url":"https://example.com/signing_url", "signing_redirect_url":"https://example.com/signing_redirect_url", "final_copy_uri":"/v3/final_copy_url", "files_url":"https://example.com/file_url", "details_url":"https://example.com/details_url", "requester_email_address":"requester_email_address@example.com", "signatures":[{"signature_id":"signature_id", "has_pin":false, "signer_email_address":"signer_email_address@example.com", "signer_name":"signer_name", "order":1, "status_code":"signed", "signed_at":1393389891, "last_viewed_at":1393389853, "last_reminded_at":1393389852}], "cc_email_addresses":[]
12
- }
13
- ]
14
- }
2
+ "list_info": {
3
+ "page": 1,
4
+ "num_pages": 1,
5
+ "num_results": 1,
6
+ "page_size": 20
7
+ },
8
+ "signature_requests": [{
9
+ "signature_request_id": "1",
10
+ "title": "title",
11
+ "original_title": "original_title",
12
+ "subject": "subject",
13
+ "message": "message",
14
+ "test_mode": false,
15
+ "is_complete": true,
16
+ "has_error": false,
17
+ "custom_fields": [],
18
+ "response_data": [{
19
+ "name": "name",
20
+ "value": "value",
21
+ "type": "signature",
22
+ "api_id": "api_id",
23
+ "signature_id": "signature_id"
24
+ }],
25
+ "signing_url": "https://example.com/signing_url",
26
+ "signing_redirect_url": "https://example.com/signing_redirect_url",
27
+ "final_copy_uri": "/v3/final_copy_url",
28
+ "files_url": "https://example.com/file_url",
29
+ "details_url": "https://example.com/details_url",
30
+ "requester_email_address": "requester_email_address@example.com",
31
+ "signatures": [{
32
+ "signature_id": "signature_id",
33
+ "has_pin": false,
34
+ "signer_email_address": "signer_email_address@example.com",
35
+ "signer_name": "signer_name",
36
+ "order": 1,
37
+ "status_code": "signed",
38
+ "signed_at": 1393389891,
39
+ "last_viewed_at": 1393389853,
40
+ "last_reminded_at": 1393389852
41
+ }],
42
+ "cc_email_addresses": []
43
+ }]
44
+ }
@@ -1,19 +1,15 @@
1
1
  {
2
- "team": {
3
- "name": "Team HelloSign",
4
- "accounts": [
5
- {
6
- "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
7
- "email_address": "me@example.com",
8
- "role_code": "a"
9
- },
10
- {
11
- "account_id": "d3d3d7b98d80b67d07740df7cdfd1f49fa8e2b82",
12
- "email_address": "teammate@example.com",
13
- "role_code": "m"
14
- }
15
- ],
16
- "invited_accounts": [
17
- ]
18
- }
19
- }
2
+ "team": {
3
+ "name": "Team HelloSign",
4
+ "accounts": [{
5
+ "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
6
+ "email_address": "me@example.com",
7
+ "role_code": "a"
8
+ }, {
9
+ "account_id": "d3d3d7b98d80b67d07740df7cdfd1f49fa8e2b82",
10
+ "email_address": "teammate@example.com",
11
+ "role_code": "m"
12
+ }],
13
+ "invited_accounts": []
14
+ }
15
+ }
@@ -1 +1,53 @@
1
- {"template":{"template_id":"a364138e0d8ae6393aa425a8ec64715580f3748b","title":"bitcoin","message":"Hello, bitcoin pdf here","is_creator":true,"can_edit":true,"signer_roles":[{"name":"Client","order":null}],"cc_roles":[],"documents":[{"index":"0","name":"bitcoin.pdf","custom_fields":[],"form_fields":[{"name":"","type":"signature","signer":"1","x":501,"y":7498,"width":120,"height":30,"required":true,"api_id":"a1ca72_9"}]}],"custom_fields":[],"named_form_fields":[{"name":"","type":"signature","signer":"1","x":501,"y":7498,"width":120,"height":30,"required":true,"api_id":"a1ca72_9"}],"accounts":[{"account_id":"a82bbf8a2fb928f239e2bd59df50e23b82b3eedd","email_address":"testuser@example.com","is_paid_hs":false,"is_paid_hf":false,"quotas":{"templates_left":0,"documents_left":3,"api_signature_requests_left":0}}]}}
1
+ {
2
+ "template": {
3
+ "template_id": "a364138e0d8ae6393aa425a8ec64715580f3748b",
4
+ "title": "bitcoin",
5
+ "message": "Hello, bitcoin pdf here",
6
+ "is_creator": true,
7
+ "can_edit": true,
8
+ "signer_roles": [{
9
+ "name": "Client",
10
+ "order": null
11
+ }],
12
+ "cc_roles": [],
13
+ "documents": [{
14
+ "index": "0",
15
+ "name": "bitcoin.pdf",
16
+ "custom_fields": [],
17
+ "form_fields": [{
18
+ "name": "",
19
+ "type": "signature",
20
+ "signer": "1",
21
+ "x": 501,
22
+ "y": 7498,
23
+ "width": 120,
24
+ "height": 30,
25
+ "required": true,
26
+ "api_id": "a1ca72_9"
27
+ }]
28
+ }],
29
+ "custom_fields": [],
30
+ "named_form_fields": [{
31
+ "name": "",
32
+ "type": "signature",
33
+ "signer": "1",
34
+ "x": 501,
35
+ "y": 7498,
36
+ "width": 120,
37
+ "height": 30,
38
+ "required": true,
39
+ "api_id": "a1ca72_9"
40
+ }],
41
+ "accounts": [{
42
+ "account_id": "a82bbf8a2fb928f239e2bd59df50e23b82b3eedd",
43
+ "email_address": "testuser@example.com",
44
+ "is_paid_hs": false,
45
+ "is_paid_hf": false,
46
+ "quotas": {
47
+ "templates_left": 0,
48
+ "documents_left": 3,
49
+ "api_signature_requests_left": 0
50
+ }
51
+ }]
52
+ }
53
+ }
@@ -1,11 +1,59 @@
1
1
  {
2
- "list_info": {
3
- "page": 1,
4
- "num_pages": 1,
5
- "num_results": 1,
6
- "page_size": 20
7
- },
8
- "templates":[
9
- {"template_id":"a364138e0d8ae6393aa425a8ec64715580f3748b","title":"bitcoin","message":"Hello, bitcoin pdf here","is_creator":true,"can_edit":true,"signer_roles":[{"name":"Client","order":null}],"cc_roles":[],"documents":[{"index":"0","name":"bitcoin.pdf","custom_fields":[],"form_fields":[{"name":"","type":"signature","signer":"1","x":501,"y":7498,"width":120,"height":30,"required":true,"api_id":"a1ca72_9"}]}],"custom_fields":[],"named_form_fields":[{"name":"","type":"signature","signer":"1","x":501,"y":7498,"width":120,"height":30,"required":true,"api_id":"a1ca72_9"}],"accounts":[{"account_id":"a82bbf8a2fb928f239e2bd59df50e23b82b3eedd","email_address":"testuser@example.com","is_paid_hs":false,"is_paid_hf":false,"quotas":{"templates_left":0,"documents_left":3,"api_signature_requests_left":0}}]}
10
- ]
11
- }
2
+ "list_info": {
3
+ "page": 1,
4
+ "num_pages": 1,
5
+ "num_results": 1,
6
+ "page_size": 20
7
+ },
8
+ "templates": [{
9
+ "template_id": "a364138e0d8ae6393aa425a8ec64715580f3748b",
10
+ "title": "bitcoin",
11
+ "message": "Hello, bitcoin pdf here",
12
+ "is_creator": true,
13
+ "can_edit": true,
14
+ "signer_roles": [{
15
+ "name": "Client",
16
+ "order": null
17
+ }],
18
+ "cc_roles": [],
19
+ "documents": [{
20
+ "index": "0",
21
+ "name": "bitcoin.pdf",
22
+ "custom_fields": [],
23
+ "form_fields": [{
24
+ "name": "",
25
+ "type": "signature",
26
+ "signer": "1",
27
+ "x": 501,
28
+ "y": 7498,
29
+ "width": 120,
30
+ "height": 30,
31
+ "required": true,
32
+ "api_id": "a1ca72_9"
33
+ }]
34
+ }],
35
+ "custom_fields": [],
36
+ "named_form_fields": [{
37
+ "name": "",
38
+ "type": "signature",
39
+ "signer": "1",
40
+ "x": 501,
41
+ "y": 7498,
42
+ "width": 120,
43
+ "height": 30,
44
+ "required": true,
45
+ "api_id": "a1ca72_9"
46
+ }],
47
+ "accounts": [{
48
+ "account_id": "a82bbf8a2fb928f239e2bd59df50e23b82b3eedd",
49
+ "email_address": "testuser@example.com",
50
+ "is_paid_hs": false,
51
+ "is_paid_hf": false,
52
+ "quotas": {
53
+ "templates_left": 0,
54
+ "documents_left": 3,
55
+ "api_signature_requests_left": 0
56
+ }
57
+ }]
58
+ }]
59
+ }
@@ -1,14 +1,14 @@
1
1
  {
2
- "account": {
3
- "account_id": "b4680b45053c7601ca1eee3b126eca6b2b0a0219",
4
- "email_address": "jill@example.com",
5
- "callback_url": null,
6
- "role_code": null
7
- },
8
- "oauth_data": {
9
- "access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
10
- "token_type": "Bearer",
11
- "refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
12
- "expires_in": 86400
13
- }
14
- }
2
+ "account": {
3
+ "account_id": "b4680b45053c7601ca1eee3b126eca6b2b0a0219",
4
+ "email_address": "jill@example.com",
5
+ "callback_url": null,
6
+ "role_code": null
7
+ },
8
+ "oauth_data": {
9
+ "access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
10
+ "token_type": "Bearer",
11
+ "refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
12
+ "expires_in": 86400
13
+ }
14
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "unclaimed_draft": {
3
- "claim_url": "https:\/\/www.hellosign.com\/send\/resendDocs?root_snapshot_guids[]=7f967b7d06e154394eab693febedf61e8ebe49eb&amp;snapshot_access_guids[]=fb848631&amp;root_snapshot_guids[]=7aedaf31e12edf9f2672a0b2ddf028aca670e101&amp;snapshot_access_guids[]=f398ef87",
4
- "signing_redirect_url" : null
5
- }
6
- }
2
+ "unclaimed_draft": {
3
+ "claim_url": "https:\/\/www.hellosign.com\/send\/resendDocs?root_snapshot_guids[]=7f967b7d06e154394eab693febedf61e8ebe49eb&amp;snapshot_access_guids[]=fb848631&amp;root_snapshot_guids[]=7aedaf31e12edf9f2672a0b2ddf028aca670e101&amp;snapshot_access_guids[]=f398ef87",
4
+ "signing_redirect_url": null
5
+ }
6
+ }
@@ -1,36 +1,34 @@
1
- require 'spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe HelloSign::Api::Account do
4
- describe "#get_account" do
4
+ describe '#get_account' do
5
5
  before do
6
- stub_get("/account", 'account')
6
+ stub_get('/account', 'account')
7
7
  @account = HelloSign.get_account
8
8
  end
9
9
 
10
- it "should get the correct resource" do
11
- expect(a_get("/account")).to have_been_made
10
+ it 'should get the correct resource' do
11
+ expect(a_get('/account')).to have_been_made
12
12
  end
13
13
 
14
- it "should return current user account" do
14
+ it 'should return current user account' do
15
15
  expect(@account).to be_an HelloSign::Resource::Account
16
16
  end
17
17
  end
18
18
 
19
-
20
-
21
- describe "#create_account" do
19
+ describe '#create_account' do
22
20
  before do
23
- stub_post("/account/create", "account")
24
- @body = {:email_address => "test@example.com", :password => "secret"}
21
+ stub_post('/account/create', 'account')
22
+ @body = { :email_address => 'test@example.com', :password => 'secret' }
25
23
  @account = HelloSign.create_account @body
26
24
  end
27
25
 
28
- it "should get the correct resource" do
29
- expect(a_post("/account/create")).to have_been_made
26
+ it 'should get the correct resource' do
27
+ expect(a_post('/account/create')).to have_been_made
30
28
  end
31
29
 
32
- it "should return information about a created account" do
33
- expect(@account.email_address).to eql("test@example.com")
30
+ it 'should return information about a created account' do
31
+ expect(@account.email_address).to eql('test@example.com')
34
32
  end
35
33
  end
36
34
  end