chargify 0.2.7 → 0.2.8
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/chargify.gemspec +1 -1
- data/lib/chargify/client.rb +1 -2
- data/test/chargify_test.rb +14 -0
- metadata +5 -5
data/chargify.gemspec
CHANGED
data/lib/chargify/client.rb
CHANGED
@@ -5,7 +5,7 @@ module Chargify
|
|
5
5
|
class Parser < HTTParty::Parser
|
6
6
|
def parse
|
7
7
|
begin
|
8
|
-
Crack::JSON.parse(body)
|
8
|
+
Crack::JSON.parse(body) || {}
|
9
9
|
rescue => e
|
10
10
|
raise UnexpectedResponseError, "Crack could not parse JSON. It said: #{e.message}. Chargify's raw response: #{body}"
|
11
11
|
end
|
@@ -230,7 +230,6 @@ module Chargify
|
|
230
230
|
|
231
231
|
def jsonify_body!(options)
|
232
232
|
options[:body] = options[:body].to_json if options[:body]
|
233
|
-
|
234
233
|
end
|
235
234
|
end
|
236
235
|
end
|
data/test/chargify_test.rb
CHANGED
@@ -338,6 +338,12 @@ class ChargifyTest < Test::Unit::TestCase
|
|
338
338
|
component.name.should == "Extra Rubies"
|
339
339
|
component.allocated_quantity.should == 42
|
340
340
|
end
|
341
|
+
|
342
|
+
should "return nil if the component is not found" do
|
343
|
+
stub_get "https://OU812:x@pengwynn.chargify.com/subscriptions/123/components/16.json", "", 404
|
344
|
+
component = @client.subscription_component 123, 16
|
345
|
+
component.should == nil
|
346
|
+
end
|
341
347
|
|
342
348
|
should "update the allocated_quantity for a component" do
|
343
349
|
stub_put "https://OU812:x@pengwynn.chargify.com/subscriptions/123/components/16.json", "component.json"
|
@@ -369,6 +375,14 @@ class ChargifyTest < Test::Unit::TestCase
|
|
369
375
|
response = @client.update_subscription_component_enabled 123, 16, true
|
370
376
|
response.success?.should == true
|
371
377
|
end
|
378
|
+
|
379
|
+
context "when there is an error" do
|
380
|
+
should "return :success? => false" do
|
381
|
+
stub_put "https://OU812:x@pengwynn.chargify.com/subscriptions/123/components/16.json", "", 404
|
382
|
+
response = @client.update_subscription_component_enabled 123, 16, true
|
383
|
+
response.success?.should == false
|
384
|
+
end
|
385
|
+
end
|
372
386
|
end
|
373
387
|
|
374
388
|
context "aliased methods" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wynn Netherland
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
requirements: []
|
194
194
|
|
195
195
|
rubyforge_project:
|
196
|
-
rubygems_version: 1.
|
196
|
+
rubygems_version: 1.3.7
|
197
197
|
signing_key:
|
198
198
|
specification_version: 3
|
199
199
|
summary: Ruby wrapper for the chargify.com SAAS and billing API
|