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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d402f3d0f5291f1c0e72180aee716fb1555ce8cd
4
- data.tar.gz: 670c20c39aea7bcff92391cbafff2b11be7df30b
3
+ metadata.gz: 208e13dde40fe8a97354321a8496e87956ec6095
4
+ data.tar.gz: 1733723435ca4476e94959ecdb1845efe42caa0b
5
5
  SHA512:
6
- metadata.gz: 54edbc80a59b7767d31d79a12442f719ddf34a5b8c5082b06da622eb5693ec7cfcccfcee1dabc23f66d25c2466c7a09baf3b5e58028ebeabd880af43b167f173
7
- data.tar.gz: 5edbb32b7ba8b80e052f5bbd8ead0a66bd5274102b33ef9fa4b23262cfd2253cc6bdf0285d635d8eaae297120df3bef6835713fd7307e77284d39f7c918d2b20
6
+ metadata.gz: 8d78f8e973cf406911ffde3a5814f795eecc8a8596eab6040281f01db14c0e8bb6bf0d514c61bbed215e2f57ab662d7ae2dd3745765f0c7ef6cabff3b3ddca26
7
+ data.tar.gz: d15450a708efba0c3a4b729633250117849b19c1a62787d49dd403a0a5285e2733850a89ecc3977922ab8d993dc8ccbfce7dffbf8cec64ae52061c909038789a
@@ -2,6 +2,7 @@ language: ruby
2
2
  before_install:
3
3
  - gem update --system
4
4
  - gem update bundler
5
+ - bundle install --no-deployment
5
6
  rvm:
6
7
  - 2.1.3
7
8
  - 2.0.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chargify_api_ares (1.4.13)
4
+ chargify_api_ares (1.4.14)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -67,4 +67,4 @@ DEPENDENCIES
67
67
  vcr
68
68
 
69
69
  BUNDLED WITH
70
- 1.14.6
70
+ 1.16.0
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
@@ -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.13'
8
- s.date = '2017-07-21'
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"]
@@ -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(cancellation_message = nil)
25
- if cancellation_message.nil?
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(element_path, {:cancellation_message => cancellation_message}.to_xml(:root => :subscription), self.class.headers.merge({'X-Http-Method-Override' => 'DELETE'}))
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
 
@@ -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.13
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-21 00:00:00.000000000 Z
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.6.10
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