chargify_api_ares 1.4.13 → 1.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +2 -2
- data/HISTORY.md +4 -0
- data/chargify_api_ares.gemspec +2 -2
- data/examples/subscriptions.rb +6 -0
- data/lib/chargify_api_ares/resources/subscription.rb +10 -3
- data/spec/remote/remote_spec.rb +24 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208e13dde40fe8a97354321a8496e87956ec6095
|
4
|
+
data.tar.gz: 1733723435ca4476e94959ecdb1845efe42caa0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d78f8e973cf406911ffde3a5814f795eecc8a8596eab6040281f01db14c0e8bb6bf0d514c61bbed215e2f57ab662d7ae2dd3745765f0c7ef6cabff3b3ddca26
|
7
|
+
data.tar.gz: d15450a708efba0c3a4b729633250117849b19c1a62787d49dd403a0a5285e2733850a89ecc3977922ab8d993dc8ccbfce7dffbf8cec64ae52061c909038789a
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.4.14 / December 7, 2017
|
2
|
+
|
3
|
+
* Allows canceling a subscription with all supported attributes [PR 161](https://github.com/chargify/chargify_api_ares/pull/161)
|
4
|
+
|
1
5
|
## 1.4.13 / July 21, 2017
|
2
6
|
|
3
7
|
* Note: No changes from 1.4.12, previous release was not officially published
|
data/chargify_api_ares.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.7'
|
5
5
|
|
6
6
|
s.name = 'chargify_api_ares'
|
7
|
-
s.version = '1.4.
|
8
|
-
s.date = '2017-07
|
7
|
+
s.version = '1.4.14'
|
8
|
+
s.date = '2017-12-07'
|
9
9
|
s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
|
10
10
|
s.description = ''
|
11
11
|
s.authors = ["Chargify Development Team"]
|
data/examples/subscriptions.rb
CHANGED
@@ -53,6 +53,12 @@ subscription.cancel
|
|
53
53
|
subscription.reload
|
54
54
|
# => #<Chargify::Subscription:0x1020ed4b0 @prefix_options={}, @attributes={"cancellation_message"=>nil, "activated_at"=>Tue Nov 17 16:00:17 UTC 2009, "expires_at"=>nil, "updated_at"=>Tue Nov 17 16:00:17 UTC 2009, "credit_card"=>#<Chargify::Subscription::CreditCard:0x10234f168 @prefix_options={}, @attributes={"card_type"=>"bogus", "expiration_year"=>2015, "masked_card_number"=>"XXXX-XXXX-XXXX-2", "first_name"=>"Michael", "expiration_month"=>1, "last_name"=>"Klett"}>, "product"=>#<Chargify::Product:0x10234f370 @prefix_options={}, @attributes={"price_in_cents"=>0, "name"=>"Chargify API Ares Test", "handle"=>"chargify-api-ares-test", "product_family"=>#<Chargify::Product::ProductFamily:0x102354708 @prefix_options={}, @attributes={"name"=>"Chargify API ARes Test", "handle"=>"chargify-api-ares-test", "id"=>79, "accounting_code"=>nil}>, "id"=>153, "accounting_code"=>nil, "interval_unit"=>"month", "interval"=>1}>, "credit_card_attributes"=>{:full_number=>"2", :expiration_year=>"2015"}, "trial_ended_at"=>nil, "id"=>331, "current_period_ends_at"=>Thu Dec 17 16:00:17 UTC 2009, "product_handle"=>"chargify-api-ares-test", "customer"=>#<Chargify::Customer:0x10234f730 @prefix_options={}, @attributes={"reference"=>"moklett", "updated_at"=>Tue Nov 17 15:51:02 UTC 2009, "id"=>331, "first_name"=>"Michael", "organization"=>"Chargify", "last_name"=>"Klett", "email"=>"moklett@example.com", "created_at"=>Tue Nov 17 15:51:02 UTC 2009}>, "trial_started_at"=>nil, "balance_in_cents"=>0, "current_period_started_at"=>Tue Nov 17 16:00:17 UTC 2009, "state"=>"canceled", "created_at"=>Tue Nov 17 16:00:17 UTC 2009, "customer_reference"=>"moklett"}>
|
55
55
|
|
56
|
+
# Cancel a subscription with key/value options (Omitted options remain nil)
|
57
|
+
subscription.cancel(
|
58
|
+
:cancellation_message => "Some cancellation message",
|
59
|
+
:reason_code => "Some reason code"
|
60
|
+
)
|
61
|
+
|
56
62
|
# Schedule a delayed cancellation
|
57
63
|
subscription.delayed_cancel
|
58
64
|
subscription.delayed_cancel(true)
|
@@ -21,12 +21,19 @@ module Chargify
|
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
def cancel(
|
25
|
-
if
|
24
|
+
def cancel(params = {})
|
25
|
+
if params.blank?
|
26
26
|
destroy
|
27
27
|
else
|
28
28
|
#Destroy does not support body, must work around it to send verb DELETE
|
29
|
-
self.connection.post(
|
29
|
+
self.connection.post(
|
30
|
+
element_path,
|
31
|
+
{
|
32
|
+
cancellation_message: params[:cancellation_message] || nil,
|
33
|
+
reason_code: params[:reason_code] || nil
|
34
|
+
}.to_xml(:root => :subscription),
|
35
|
+
self.class.headers.merge({'X-Http-Method-Override' => 'DELETE'})
|
36
|
+
)
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
data/spec/remote/remote_spec.rb
CHANGED
@@ -330,6 +330,30 @@ describe "Remote" do
|
|
330
330
|
@subscription.cancel
|
331
331
|
Chargify::Subscription.find(@subscription.id).state.should == 'canceled'
|
332
332
|
end
|
333
|
+
|
334
|
+
it "does not set optional attributes" do
|
335
|
+
@subscription.cancel
|
336
|
+
@subscription.reload.cancellation_message.should be_nil
|
337
|
+
@subscription.reload.reason_code.should be_nil
|
338
|
+
end
|
339
|
+
|
340
|
+
it "only sets optional cancellation_message attribute" do
|
341
|
+
@subscription.cancel(cancellation_message: "This is a cancellation message.")
|
342
|
+
@subscription.reload.cancellation_message.should == "This is a cancellation message."
|
343
|
+
@subscription.reload.reason_code.should be_nil
|
344
|
+
end
|
345
|
+
|
346
|
+
it "only sets optional reason_code attribute" do
|
347
|
+
@subscription.cancel(reason_code: "This is a reason code.")
|
348
|
+
@subscription.reload.cancellation_message.should be_nil
|
349
|
+
@subscription.reload.reason_code.should == "This is a reason code."
|
350
|
+
end
|
351
|
+
|
352
|
+
it "sets multiple optional attributes" do
|
353
|
+
@subscription.cancel(cancellation_message: "This is a cancellation message.", reason_code: "This is a reason code.")
|
354
|
+
@subscription.reload.cancellation_message.should == "This is a cancellation message."
|
355
|
+
@subscription.reload.reason_code.should == "This is a reason code."
|
356
|
+
end
|
333
357
|
end
|
334
358
|
|
335
359
|
describe "scheduling a subscription cancellation" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargify_api_ares
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chargify Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.5.2.1
|
274
274
|
signing_key:
|
275
275
|
specification_version: 3
|
276
276
|
summary: A Chargify API wrapper for Ruby using ActiveResource
|