hellosign-ruby-sdk 3.0.0

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 (54) hide show
  1. data/.gitignore +18 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +15 -0
  4. data/Gemfile +13 -0
  5. data/Guardfile +14 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +58 -0
  8. data/Rakefile +16 -0
  9. data/hellosign-ruby-sdk.gemspec +27 -0
  10. data/lib/hello_sign.rb +32 -0
  11. data/lib/hello_sign/api.rb +7 -0
  12. data/lib/hello_sign/api/account.rb +69 -0
  13. data/lib/hello_sign/api/embedded.rb +27 -0
  14. data/lib/hello_sign/api/oauth.rb +63 -0
  15. data/lib/hello_sign/api/signature_request.rb +286 -0
  16. data/lib/hello_sign/api/team.rb +88 -0
  17. data/lib/hello_sign/api/template.rb +77 -0
  18. data/lib/hello_sign/api/unclaimed_draft.rb +127 -0
  19. data/lib/hello_sign/client.rb +211 -0
  20. data/lib/hello_sign/configuration.rb +56 -0
  21. data/lib/hello_sign/error.rb +48 -0
  22. data/lib/hello_sign/resource.rb +8 -0
  23. data/lib/hello_sign/resource/account.rb +24 -0
  24. data/lib/hello_sign/resource/base_resource.rb +60 -0
  25. data/lib/hello_sign/resource/embedded.rb +24 -0
  26. data/lib/hello_sign/resource/resource_array.rb +33 -0
  27. data/lib/hello_sign/resource/signature_request.rb +25 -0
  28. data/lib/hello_sign/resource/team.rb +24 -0
  29. data/lib/hello_sign/resource/template.rb +25 -0
  30. data/lib/hello_sign/resource/unclaimed_draft.rb +25 -0
  31. data/lib/hello_sign/version.rb +3 -0
  32. data/spec/fixtures/account.json +1 -0
  33. data/spec/fixtures/embedded.json +6 -0
  34. data/spec/fixtures/error.json +6 -0
  35. data/spec/fixtures/file.json +0 -0
  36. data/spec/fixtures/signature_request.json +2 -0
  37. data/spec/fixtures/signature_requests.json +14 -0
  38. data/spec/fixtures/team.json +19 -0
  39. data/spec/fixtures/template.json +1 -0
  40. data/spec/fixtures/templates.json +11 -0
  41. data/spec/fixtures/token.json +14 -0
  42. data/spec/fixtures/unclaimed_draft.json +6 -0
  43. data/spec/hello_sign/api/account_spec.rb +36 -0
  44. data/spec/hello_sign/api/embedded_spec.rb +19 -0
  45. data/spec/hello_sign/api/oauth_spec.rb +28 -0
  46. data/spec/hello_sign/api/signature_request_spec.rb +126 -0
  47. data/spec/hello_sign/api/team_spec.rb +94 -0
  48. data/spec/hello_sign/api/template_spec.rb +67 -0
  49. data/spec/hello_sign/api/unclaimed_draft_spec.rb +35 -0
  50. data/spec/hello_sign/client_spec.rb +132 -0
  51. data/spec/hello_sign/resource/base_resource_spec.rb +50 -0
  52. data/spec/hello_sign_spec.rb +35 -0
  53. data/spec/spec_helper.rb +78 -0
  54. metadata +216 -0
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign::Resource::BaseResource do
4
+ let(:data){{
5
+ :a => :a1,
6
+ :b => :b1,
7
+ :c => { :c1 => :c2},
8
+ :d => [ :d1, :d2, :d3],
9
+ :e => [ {:e1 => :e11}, {:e2 => :e21}, {:e3 => :e31}]
10
+ }}
11
+
12
+ describe "methods" do
13
+ subject(:resource) {HelloSign::Resource::BaseResource.new data }
14
+
15
+ it 'can access attributes by calling method with the same name' do
16
+ data.keys.each do |key|
17
+ expect(resource.send key).not_to be_empty
18
+ end
19
+ end
20
+
21
+ it 'make a hash value into a new HelloSign::Resource::BaseResource' do
22
+ expect(resource.c).to be_an HelloSign::Resource::BaseResource
23
+ end
24
+
25
+ it 'do not touch array value with basic type' do
26
+ expect(resource.d).to eql(data[:d])
27
+ end
28
+
29
+ it 'make a array value with each item is a hash into array of HelloSign::Resource::BaseResource' do
30
+ expect(resource.e).to be_an Array
31
+ expect(resource.e[0]).to be_an HelloSign::Resource::BaseResource
32
+ end
33
+ end
34
+
35
+ describe "#initialize" do
36
+ context 'without key params' do
37
+ subject(:resource) {HelloSign::Resource::BaseResource.new data }
38
+ it "have correct data" do
39
+ expect(resource.data).to eql(data)
40
+ end
41
+ end
42
+
43
+ context 'without key params' do
44
+ subject(:resource) {HelloSign::Resource::BaseResource.new data, :e }
45
+ it "have correct data" do
46
+ expect(resource.data).to eql(data[:e])
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe HelloSign do
4
+ after { HelloSign.reset }
5
+
6
+ describe ".client" do
7
+ it "should be a HelloSign::Client" do
8
+ expect(HelloSign.client).to be_a(HelloSign::Client)
9
+ end
10
+ end
11
+
12
+ describe ".configure" do
13
+ HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
14
+ it "should set #{key}" do
15
+ HelloSign.configure do |config|
16
+ config.send("#{key}=", key)
17
+ expect(HelloSign.send(key)).to eql(key)
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ describe ".user_agent=" do
24
+ it "should set user_agent" do
25
+ HelloSign.user_agent = 'Custom User Agent'
26
+ expect(HelloSign.user_agent).to eql('Custom User Agent')
27
+ end
28
+ end
29
+
30
+ describe ".user_agent" do
31
+ it "should return default user_agent" do
32
+ expect(HelloSign.user_agent).to eql(HelloSign::Configuration::DEFAULT_USER_AGENT)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,78 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ if ENV['TRAVIS']
7
+ require 'coveralls'
8
+ Coveralls.wear!
9
+ end
10
+
11
+ require 'webmock/rspec'
12
+ require 'pry'
13
+ require File.expand_path('../../lib/hello_sign', __FILE__)
14
+
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ config.expect_with :rspec do |c|
18
+ c.syntax = :expect
19
+ end
20
+ config.treat_symbols_as_metadata_keys_with_true_values = true
21
+ config.run_all_when_everything_filtered = true
22
+ config.filter_run :focus
23
+
24
+ # Run specs in random order to surface order dependencies. If you find an
25
+ # order dependency and want to debug it, you can fix the order by providing
26
+ # the seed, which is printed after each run.
27
+ # --seed 1234
28
+ config.order = 'random'
29
+ end
30
+
31
+ def load_fixture(name)
32
+ File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json")
33
+ end
34
+
35
+ def stub_get(path, fixture, status_code=200)
36
+ stub_request(:get, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
37
+ to_return(:body => load_fixture(fixture), :status => status_code)
38
+ end
39
+
40
+ def a_get(path)
41
+ a_request(:get, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}")
42
+ end
43
+
44
+ def stub_post(path, fixture, status_code=200)
45
+ stub_request(:post, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
46
+ to_return(:body => load_fixture(fixture), :status => status_code)
47
+ end
48
+
49
+ def stub_post_oauth(path, fixture, status_code=200)
50
+ stub_request(:post, "#{HelloSign.oauth_end_point}#{path}").
51
+ to_return(:body => load_fixture(fixture), :status => status_code)
52
+ end
53
+
54
+ def a_post(path)
55
+ a_request(:post, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}")
56
+ end
57
+
58
+ def a_post_oauth(path)
59
+ a_request(:post, "#{HelloSign.oauth_end_point}#{path}")
60
+ end
61
+
62
+ def stub_put(path, fixture)
63
+ stub_request(:put, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
64
+ to_return(:body => load_fixture(fixture))
65
+ end
66
+
67
+ def a_put(path)
68
+ a_request(:put, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}")
69
+ end
70
+
71
+ def stub_delete(path, fixture)
72
+ stub_request(:delete, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
73
+ to_return(:body => load_fixture(fixture))
74
+ end
75
+
76
+ def a_delete(path)
77
+ a_request(:delete, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}")
78
+ end
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hellosign-ruby-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - HelloSign
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.5'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: webmock
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: faraday
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: multi_json
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: ''
111
+ email: support@hellosign.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - .gitignore
117
+ - .rspec
118
+ - .travis.yml
119
+ - Gemfile
120
+ - Guardfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - hellosign-ruby-sdk.gemspec
125
+ - lib/hello_sign.rb
126
+ - lib/hello_sign/api.rb
127
+ - lib/hello_sign/api/account.rb
128
+ - lib/hello_sign/api/embedded.rb
129
+ - lib/hello_sign/api/oauth.rb
130
+ - lib/hello_sign/api/signature_request.rb
131
+ - lib/hello_sign/api/team.rb
132
+ - lib/hello_sign/api/template.rb
133
+ - lib/hello_sign/api/unclaimed_draft.rb
134
+ - lib/hello_sign/client.rb
135
+ - lib/hello_sign/configuration.rb
136
+ - lib/hello_sign/error.rb
137
+ - lib/hello_sign/resource.rb
138
+ - lib/hello_sign/resource/account.rb
139
+ - lib/hello_sign/resource/base_resource.rb
140
+ - lib/hello_sign/resource/embedded.rb
141
+ - lib/hello_sign/resource/resource_array.rb
142
+ - lib/hello_sign/resource/signature_request.rb
143
+ - lib/hello_sign/resource/team.rb
144
+ - lib/hello_sign/resource/template.rb
145
+ - lib/hello_sign/resource/unclaimed_draft.rb
146
+ - lib/hello_sign/version.rb
147
+ - spec/fixtures/account.json
148
+ - spec/fixtures/embedded.json
149
+ - spec/fixtures/error.json
150
+ - spec/fixtures/file.json
151
+ - spec/fixtures/signature_request.json
152
+ - spec/fixtures/signature_requests.json
153
+ - spec/fixtures/team.json
154
+ - spec/fixtures/template.json
155
+ - spec/fixtures/templates.json
156
+ - spec/fixtures/token.json
157
+ - spec/fixtures/unclaimed_draft.json
158
+ - spec/hello_sign/api/account_spec.rb
159
+ - spec/hello_sign/api/embedded_spec.rb
160
+ - spec/hello_sign/api/oauth_spec.rb
161
+ - spec/hello_sign/api/signature_request_spec.rb
162
+ - spec/hello_sign/api/team_spec.rb
163
+ - spec/hello_sign/api/template_spec.rb
164
+ - spec/hello_sign/api/unclaimed_draft_spec.rb
165
+ - spec/hello_sign/client_spec.rb
166
+ - spec/hello_sign/resource/base_resource_spec.rb
167
+ - spec/hello_sign_spec.rb
168
+ - spec/spec_helper.rb
169
+ homepage: http://www.hellosign.com
170
+ licenses:
171
+ - MIT
172
+ post_install_message:
173
+ rdoc_options: []
174
+ require_paths:
175
+ - lib
176
+ required_ruby_version: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ requirements: []
189
+ rubyforge_project:
190
+ rubygems_version: 1.8.23
191
+ signing_key:
192
+ specification_version: 3
193
+ summary: A Ruby SDK for the HelloSign API.
194
+ test_files:
195
+ - spec/fixtures/account.json
196
+ - spec/fixtures/embedded.json
197
+ - spec/fixtures/error.json
198
+ - spec/fixtures/file.json
199
+ - spec/fixtures/signature_request.json
200
+ - spec/fixtures/signature_requests.json
201
+ - spec/fixtures/team.json
202
+ - spec/fixtures/template.json
203
+ - spec/fixtures/templates.json
204
+ - spec/fixtures/token.json
205
+ - spec/fixtures/unclaimed_draft.json
206
+ - spec/hello_sign/api/account_spec.rb
207
+ - spec/hello_sign/api/embedded_spec.rb
208
+ - spec/hello_sign/api/oauth_spec.rb
209
+ - spec/hello_sign/api/signature_request_spec.rb
210
+ - spec/hello_sign/api/team_spec.rb
211
+ - spec/hello_sign/api/template_spec.rb
212
+ - spec/hello_sign/api/unclaimed_draft_spec.rb
213
+ - spec/hello_sign/client_spec.rb
214
+ - spec/hello_sign/resource/base_resource_spec.rb
215
+ - spec/hello_sign_spec.rb
216
+ - spec/spec_helper.rb