bill_forward 1.2014.296

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 (84) hide show
  1. data/.gitignore +27 -0
  2. data/.idea/.name +1 -0
  3. data/.idea/compiler.xml +23 -0
  4. data/.idea/copyright/profiles_settings.xml +3 -0
  5. data/.idea/encodings.xml +5 -0
  6. data/.idea/inspectionProfiles/Project_Default.xml +11 -0
  7. data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
  8. data/.idea/misc.xml +23 -0
  9. data/.idea/modules.xml +9 -0
  10. data/.idea/scopes/scope_settings.xml +5 -0
  11. data/.idea/vcs.xml +7 -0
  12. data/.rspec +2 -0
  13. data/Gemfile +9 -0
  14. data/LICENSE.md +22 -0
  15. data/README.md +227 -0
  16. data/Rakefile +73 -0
  17. data/bill_forward.gemspec +29 -0
  18. data/bill_forward.iml +28 -0
  19. data/lib/bill_forward.rb +18 -0
  20. data/lib/bill_forward/billing_entity.rb +263 -0
  21. data/lib/bill_forward/client.rb +355 -0
  22. data/lib/bill_forward/custom_hash.rb +14 -0
  23. data/lib/bill_forward/deny_method.rb +4 -0
  24. data/lib/bill_forward/entities/account.rb +19 -0
  25. data/lib/bill_forward/entities/address.rb +25 -0
  26. data/lib/bill_forward/entities/amendments/amendment.rb +11 -0
  27. data/lib/bill_forward/entities/amendments/invoice_recalculation_amendment.rb +10 -0
  28. data/lib/bill_forward/entities/api_configuration.rb +11 -0
  29. data/lib/bill_forward/entities/authorize_net_token.rb +9 -0
  30. data/lib/bill_forward/entities/credit_note.rb +13 -0
  31. data/lib/bill_forward/entities/invoice.rb +25 -0
  32. data/lib/bill_forward/entities/invoice_parts/invoice_line.rb +37 -0
  33. data/lib/bill_forward/entities/invoice_parts/invoice_payment.rb +29 -0
  34. data/lib/bill_forward/entities/invoice_parts/tax_line.rb +23 -0
  35. data/lib/bill_forward/entities/invoice_parts/taxation_link.rb +5 -0
  36. data/lib/bill_forward/entities/organisation.rb +37 -0
  37. data/lib/bill_forward/entities/payment_method.rb +5 -0
  38. data/lib/bill_forward/entities/payment_method_subscription_link.rb +5 -0
  39. data/lib/bill_forward/entities/pricing_component.rb +21 -0
  40. data/lib/bill_forward/entities/pricing_component_tier.rb +5 -0
  41. data/lib/bill_forward/entities/pricing_component_value.rb +5 -0
  42. data/lib/bill_forward/entities/pricing_component_value_change.rb +5 -0
  43. data/lib/bill_forward/entities/product.rb +5 -0
  44. data/lib/bill_forward/entities/product_rate_plan.rb +19 -0
  45. data/lib/bill_forward/entities/profile.rb +15 -0
  46. data/lib/bill_forward/entities/role.rb +4 -0
  47. data/lib/bill_forward/entities/subscription.rb +53 -0
  48. data/lib/bill_forward/entities/unit_of_measure.rb +5 -0
  49. data/lib/bill_forward/insertable_entity.rb +32 -0
  50. data/lib/bill_forward/mutable_entity.rb +47 -0
  51. data/lib/bill_forward/resource_path.rb +11 -0
  52. data/lib/bill_forward/type_check.rb +21 -0
  53. data/lib/bill_forward/version.rb +4 -0
  54. data/spec/component/account_spec.rb +200 -0
  55. data/spec/component/billing_entity_spec.rb +153 -0
  56. data/spec/component/invoice_spec.rb +155 -0
  57. data/spec/component/subscription_spec.rb +357 -0
  58. data/spec/functional/account_spec.rb +25 -0
  59. data/spec/functional/bad_citizen/account_spec.rb +103 -0
  60. data/spec/functional/bad_citizen/credit_note_spec.rb +41 -0
  61. data/spec/functional/bad_citizen/payment_method_spec.rb +34 -0
  62. data/spec/functional/bad_citizen/product_rate_plan_spec.rb +105 -0
  63. data/spec/functional/bad_citizen/product_spec.rb +22 -0
  64. data/spec/functional/bad_citizen/situational/authorize_net_token_spec.rb +27 -0
  65. data/spec/functional/bad_citizen/situational/invoice_recalculation_amendment_spec.rb +27 -0
  66. data/spec/functional/bad_citizen/situational/invoice_spec.rb +22 -0
  67. data/spec/functional/bad_citizen/situational/malordered_entity_spec.rb +43 -0
  68. data/spec/functional/bad_citizen/situational/organisation_spec.rb +39 -0
  69. data/spec/functional/bad_citizen/situational/payment_method_spec.rb +47 -0
  70. data/spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb +255 -0
  71. data/spec/functional/bad_citizen/subscription_spec.rb +179 -0
  72. data/spec/functional/bad_citizen/subscription_with_credit_spec.rb +240 -0
  73. data/spec/functional/bad_citizen/unit_of_measure_spec.rb +20 -0
  74. data/spec/functional/billing_entity_spec.rb +22 -0
  75. data/spec/functional/client_spec.rb +24 -0
  76. data/spec/functional/organisation_spec.rb +28 -0
  77. data/spec/setup_test_constants.rb +73 -0
  78. data/spec/spec_helper.rb +11 -0
  79. data/spec/syntax/account_spec.rb +24 -0
  80. data/spec/syntax/address_spec.rb +19 -0
  81. data/spec/syntax/api_configuration_spec.rb +13 -0
  82. data/spec/syntax/billing_entity_spec.rb +93 -0
  83. data/spec/syntax/client_spec.rb +8 -0
  84. metadata +287 -0
@@ -0,0 +1,19 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Address do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ describe '::get_by_id' do
9
+ it 'raises error' do
10
+ id = 'whatever'
11
+ expect{BillForward::Address.get_by_id id}.to raise_error(BillForward::DenyMethod)
12
+ end
13
+ end
14
+ describe '::get_all' do
15
+ it 'raises error' do
16
+ expect{BillForward::Address.get_all}.to raise_error(BillForward::DenyMethod)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Profile do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ describe '::create' do
9
+ it 'raises error' do
10
+ expect{BillForward::APIConfiguration.create}.to raise_error(BillForward::DenyMethod)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,93 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::BillingEntity do
4
+ before :all do
5
+ @host="http://localhost:8080/RestAPI/"
6
+ @token1="sometoken1"
7
+ @token2="sometoken2"
8
+ @dudclient1 = BillForward::Client.new(
9
+ :host => @host,
10
+ :api_token => @token1
11
+ )
12
+ @dudclient2 = BillForward::Client.new(
13
+ :host => @host,
14
+ :api_token => @token2
15
+ )
16
+ end
17
+ describe '.client' do
18
+ context 'with differing clients' do
19
+ it 'differs on each entity' do
20
+ entity1 = BillForward::Account.new(nil, @dudclient1)
21
+ entity2 = BillForward::Account.new(nil, @dudclient2)
22
+ expect(entity1._client.api_token).to eq(@token1)
23
+ expect(entity2._client.api_token).to eq(@token2)
24
+ end
25
+ end
26
+ context 'before creation of singleton client' do
27
+ it 'raises error' do
28
+ BillForward::Client.default_client = nil
29
+ expect{BillForward::Account.new}.to raise_error(BillForward::ClientInstantiationException)
30
+ end
31
+ end
32
+ context 'with "set" singleton client' do
33
+ it 'uses default client' do
34
+ BillForward::Client.default_client = @dudclient1
35
+ entity = BillForward::Account.new
36
+ expect(entity._client.api_token).to eq(@token1)
37
+ end
38
+ end
39
+ context 'with "made" singleton client' do
40
+ it 'uses default client' do
41
+ dudclient_options = {
42
+ :host => @host,
43
+ :api_token => @token2
44
+ }
45
+ BillForward::Client.make_default_client(dudclient_options)
46
+ entity = BillForward::Account.new
47
+ expect(entity._client.api_token).to eq(@token2)
48
+ end
49
+ end
50
+ context 'despite "set" singleton client' do
51
+ it 'prefers provided client to default' do
52
+ BillForward::Client.default_client = @dudclient1
53
+ entity = BillForward::Account.new(nil, @dudclient2)
54
+ expect(entity._client.api_token).to eq(@token2)
55
+ end
56
+ end
57
+ context 'with change in singleton client' do
58
+ context 'per instantiation' do
59
+ it 'uses creation-time latest client' do
60
+ BillForward::Client.default_client = @dudclient1
61
+ entity1 = BillForward::Account.new
62
+ expect(entity1._client.api_token).to eq(@token1)
63
+ BillForward::Client.default_client = @dudclient2
64
+ entity2 = BillForward::Account.new
65
+ expect(entity2._client.api_token).to eq(@token2)
66
+ expect(entity1._client.api_token).to eq(@token1)
67
+ end
68
+ end
69
+ context 'before instantiation' do
70
+ it 'uses same client on each entity' do
71
+ BillForward::Client.default_client = @dudclient1
72
+ BillForward::Client.default_client = @dudclient2
73
+ entity1 = BillForward::Account.new
74
+ entity2 = BillForward::Account.new
75
+ expect(entity1._client.api_token).to eq(@token2)
76
+ expect(entity2._client.api_token).to eq(@token2)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ describe '::resource_path' do
82
+ it "points to expected endpoint" do
83
+ resource_path = BillForward::Account.resource_path
84
+ expect(resource_path.path).to eq("accounts")
85
+ end
86
+ it "supports multiple entities with endpoints" do
87
+ resource_path1 = BillForward::Account.resource_path
88
+ expect(resource_path1.path).to eq("accounts")
89
+ resource_path2 = BillForward::PaymentMethod.resource_path
90
+ expect(resource_path2.path).to eq("payment-methods")
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,8 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Client do
4
+ describe '#new' do
5
+ # TODO: confirm that client ends with a /
6
+ # TODO (functional): confirm that 404 of endpoint or of API URL is handled gracefully
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,287 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bill_forward
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7487
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2014
9
+ - 296
10
+ version: 1.2014.296
11
+ platform: ruby
12
+ authors:
13
+ - BillForward
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2014-10-24 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rest-client
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 31
29
+ segments:
30
+ - 1
31
+ - 6
32
+ - 8
33
+ version: 1.6.8
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 53
45
+ segments:
46
+ - 1
47
+ - 8
48
+ - 1
49
+ version: 1.8.1
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: require_all
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ type: :runtime
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: activesupport
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 3
77
+ - 1
78
+ - 0
79
+ version: 3.1.0
80
+ - - <
81
+ - !ruby/object:Gem::Version
82
+ hash: 11
83
+ segments:
84
+ - 4
85
+ version: "4"
86
+ type: :runtime
87
+ version_requirements: *id004
88
+ - !ruby/object:Gem::Dependency
89
+ name: bundler
90
+ prerelease: false
91
+ requirement: &id005 !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ hash: 3
97
+ segments:
98
+ - 1
99
+ - 6
100
+ version: "1.6"
101
+ type: :development
102
+ version_requirements: *id005
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ prerelease: false
106
+ requirement: &id006 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ type: :development
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: rake
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ type: :development
130
+ version_requirements: *id007
131
+ description: Enables you to call the BillForward API easily using Ruby
132
+ email:
133
+ - support@billforward.net
134
+ executables: []
135
+
136
+ extensions: []
137
+
138
+ extra_rdoc_files: []
139
+
140
+ files:
141
+ - .gitignore
142
+ - .idea/.name
143
+ - .idea/compiler.xml
144
+ - .idea/copyright/profiles_settings.xml
145
+ - .idea/encodings.xml
146
+ - .idea/inspectionProfiles/Project_Default.xml
147
+ - .idea/inspectionProfiles/profiles_settings.xml
148
+ - .idea/misc.xml
149
+ - .idea/modules.xml
150
+ - .idea/scopes/scope_settings.xml
151
+ - .idea/vcs.xml
152
+ - .rspec
153
+ - Gemfile
154
+ - LICENSE.md
155
+ - README.md
156
+ - Rakefile
157
+ - bill_forward.gemspec
158
+ - bill_forward.iml
159
+ - lib/bill_forward.rb
160
+ - lib/bill_forward/billing_entity.rb
161
+ - lib/bill_forward/client.rb
162
+ - lib/bill_forward/custom_hash.rb
163
+ - lib/bill_forward/deny_method.rb
164
+ - lib/bill_forward/entities/account.rb
165
+ - lib/bill_forward/entities/address.rb
166
+ - lib/bill_forward/entities/amendments/amendment.rb
167
+ - lib/bill_forward/entities/amendments/invoice_recalculation_amendment.rb
168
+ - lib/bill_forward/entities/api_configuration.rb
169
+ - lib/bill_forward/entities/authorize_net_token.rb
170
+ - lib/bill_forward/entities/credit_note.rb
171
+ - lib/bill_forward/entities/invoice.rb
172
+ - lib/bill_forward/entities/invoice_parts/invoice_line.rb
173
+ - lib/bill_forward/entities/invoice_parts/invoice_payment.rb
174
+ - lib/bill_forward/entities/invoice_parts/tax_line.rb
175
+ - lib/bill_forward/entities/invoice_parts/taxation_link.rb
176
+ - lib/bill_forward/entities/organisation.rb
177
+ - lib/bill_forward/entities/payment_method.rb
178
+ - lib/bill_forward/entities/payment_method_subscription_link.rb
179
+ - lib/bill_forward/entities/pricing_component.rb
180
+ - lib/bill_forward/entities/pricing_component_tier.rb
181
+ - lib/bill_forward/entities/pricing_component_value.rb
182
+ - lib/bill_forward/entities/pricing_component_value_change.rb
183
+ - lib/bill_forward/entities/product.rb
184
+ - lib/bill_forward/entities/product_rate_plan.rb
185
+ - lib/bill_forward/entities/profile.rb
186
+ - lib/bill_forward/entities/role.rb
187
+ - lib/bill_forward/entities/subscription.rb
188
+ - lib/bill_forward/entities/unit_of_measure.rb
189
+ - lib/bill_forward/insertable_entity.rb
190
+ - lib/bill_forward/mutable_entity.rb
191
+ - lib/bill_forward/resource_path.rb
192
+ - lib/bill_forward/type_check.rb
193
+ - lib/bill_forward/version.rb
194
+ - spec/component/account_spec.rb
195
+ - spec/component/billing_entity_spec.rb
196
+ - spec/component/invoice_spec.rb
197
+ - spec/component/subscription_spec.rb
198
+ - spec/functional/account_spec.rb
199
+ - spec/functional/bad_citizen/account_spec.rb
200
+ - spec/functional/bad_citizen/credit_note_spec.rb
201
+ - spec/functional/bad_citizen/payment_method_spec.rb
202
+ - spec/functional/bad_citizen/product_rate_plan_spec.rb
203
+ - spec/functional/bad_citizen/product_spec.rb
204
+ - spec/functional/bad_citizen/situational/authorize_net_token_spec.rb
205
+ - spec/functional/bad_citizen/situational/invoice_recalculation_amendment_spec.rb
206
+ - spec/functional/bad_citizen/situational/invoice_spec.rb
207
+ - spec/functional/bad_citizen/situational/malordered_entity_spec.rb
208
+ - spec/functional/bad_citizen/situational/organisation_spec.rb
209
+ - spec/functional/bad_citizen/situational/payment_method_spec.rb
210
+ - spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb
211
+ - spec/functional/bad_citizen/subscription_spec.rb
212
+ - spec/functional/bad_citizen/subscription_with_credit_spec.rb
213
+ - spec/functional/bad_citizen/unit_of_measure_spec.rb
214
+ - spec/functional/billing_entity_spec.rb
215
+ - spec/functional/client_spec.rb
216
+ - spec/functional/organisation_spec.rb
217
+ - spec/setup_test_constants.rb
218
+ - spec/spec_helper.rb
219
+ - spec/syntax/account_spec.rb
220
+ - spec/syntax/address_spec.rb
221
+ - spec/syntax/api_configuration_spec.rb
222
+ - spec/syntax/billing_entity_spec.rb
223
+ - spec/syntax/client_spec.rb
224
+ homepage: http://www.billforward.net
225
+ licenses:
226
+ - MIT
227
+ post_install_message:
228
+ rdoc_options: []
229
+
230
+ require_paths:
231
+ - lib
232
+ required_ruby_version: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ hash: 3
238
+ segments:
239
+ - 0
240
+ version: "0"
241
+ required_rubygems_version: !ruby/object:Gem::Requirement
242
+ none: false
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ hash: 3
247
+ segments:
248
+ - 0
249
+ version: "0"
250
+ requirements: []
251
+
252
+ rubyforge_project:
253
+ rubygems_version: 1.8.24
254
+ signing_key:
255
+ specification_version: 3
256
+ summary: BillForward Ruby Client Library
257
+ test_files:
258
+ - spec/component/account_spec.rb
259
+ - spec/component/billing_entity_spec.rb
260
+ - spec/component/invoice_spec.rb
261
+ - spec/component/subscription_spec.rb
262
+ - spec/functional/account_spec.rb
263
+ - spec/functional/bad_citizen/account_spec.rb
264
+ - spec/functional/bad_citizen/credit_note_spec.rb
265
+ - spec/functional/bad_citizen/payment_method_spec.rb
266
+ - spec/functional/bad_citizen/product_rate_plan_spec.rb
267
+ - spec/functional/bad_citizen/product_spec.rb
268
+ - spec/functional/bad_citizen/situational/authorize_net_token_spec.rb
269
+ - spec/functional/bad_citizen/situational/invoice_recalculation_amendment_spec.rb
270
+ - spec/functional/bad_citizen/situational/invoice_spec.rb
271
+ - spec/functional/bad_citizen/situational/malordered_entity_spec.rb
272
+ - spec/functional/bad_citizen/situational/organisation_spec.rb
273
+ - spec/functional/bad_citizen/situational/payment_method_spec.rb
274
+ - spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb
275
+ - spec/functional/bad_citizen/subscription_spec.rb
276
+ - spec/functional/bad_citizen/subscription_with_credit_spec.rb
277
+ - spec/functional/bad_citizen/unit_of_measure_spec.rb
278
+ - spec/functional/billing_entity_spec.rb
279
+ - spec/functional/client_spec.rb
280
+ - spec/functional/organisation_spec.rb
281
+ - spec/setup_test_constants.rb
282
+ - spec/spec_helper.rb
283
+ - spec/syntax/account_spec.rb
284
+ - spec/syntax/address_spec.rb
285
+ - spec/syntax/api_configuration_spec.rb
286
+ - spec/syntax/billing_entity_spec.rb
287
+ - spec/syntax/client_spec.rb