chargify_api_ares 1.4.14 → 1.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +2 -2
- data/HISTORY.md +5 -0
- data/README.md +6 -2
- data/chargify_api_ares.gemspec +2 -2
- data/lib/chargify_api_ares/resources/subscription.rb +1 -1
- data/spec/remote/remote_spec.rb +82 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9df580c55a36eb2d98f33aef4030cddca3758e96e8a08fce6922c4a8a9ab4bf9
|
4
|
+
data.tar.gz: 2b97d5712cd2b0b1a9e9c9776bc930dbd5f1f5523d90cfcb4f842dbc530d5981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab6fb12e2711d83bc41a301ffeeb58f6e6c041f12659fd5ce4758442b8708dfe5e7d6a7586ec4dea6be4e7fd17f760aa83c03677e0a66c2fec6d2aaeb77d2919
|
7
|
+
data.tar.gz: 7e6f9bfc00e560a5330975be5d7959e4f503fe7c9787a3e2969f4edb8a44c4650cba46016834fff7d9e3b173819860a711026f51e0e4d759e12f51a891a2c9d1
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 1.4.15 / June 20, 2018
|
2
|
+
|
3
|
+
* Changes Subscription#remove_coupon to use coupon_code instead of code [PR 165](https://github.com/chargify/chargify_api_ares/pull/165).
|
4
|
+
With this change, the currently applied coupon code must be passed for removal to occur.
|
5
|
+
|
1
6
|
## 1.4.14 / December 7, 2017
|
2
7
|
|
3
8
|
* Allows canceling a subscription with all supported attributes [PR 161](https://github.com/chargify/chargify_api_ares/pull/161)
|
data/README.md
CHANGED
@@ -2,12 +2,16 @@ Chargify API wrapper for Ruby (using ActiveResource)
|
|
2
2
|
====================================================
|
3
3
|
[![build status](https://secure.travis-ci.org/chargify/chargify_api_ares.png)](http://travis-ci.org/chargify/chargify_api_ares) [![Code Climate](https://codeclimate.com/github/chargify/chargify_api_ares/badges/gpa.svg)](https://codeclimate.com/github/chargify/chargify_api_ares)
|
4
4
|
|
5
|
+
This is a community-maintained Ruby wrapper for the [Chargify](https://www.chargify.com) API that leverages ActiveResource.
|
6
|
+
|
7
|
+
Though we do not proactively maintain it, Chargify is happy to review pull requests and manage the release process for the gem. We encourage community contributions to make the wrapper even more comprehensive and powerful.
|
8
|
+
|
9
|
+
If you notice an endpoint or method that is missing, please feel free to add it by submitting a pull request. We appreciate your support!
|
10
|
+
|
5
11
|
**Note:** we have bumped to v1.0.0 to indicate a backwards incompatible change to the responses from `Chargify::Subscription.charge` and `Chargify::Subscription.migrate`. Please see the HISTORY.md for more information.
|
6
12
|
|
7
13
|
**Please see important compatibility information at the bottom of this file.**
|
8
14
|
|
9
|
-
This is a Ruby wrapper for the [Chargify](http://chargify.com) API that leverages ActiveResource.
|
10
|
-
|
11
15
|
### Installation
|
12
16
|
|
13
17
|
This library can be installed as a gem. It is hosted on [Rubygems](http://rubygems.org).
|
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 = '
|
7
|
+
s.version = '1.4.15'
|
8
|
+
s.date = '2018-06-20'
|
9
9
|
s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
|
10
10
|
s.description = ''
|
11
11
|
s.authors = ["Chargify Development Team"]
|
data/spec/remote/remote_spec.rb
CHANGED
@@ -645,6 +645,88 @@ describe "Remote" do
|
|
645
645
|
end
|
646
646
|
end
|
647
647
|
|
648
|
+
describe "removing a coupon" do
|
649
|
+
let(:coupon1) do
|
650
|
+
Chargify::Coupon.create(
|
651
|
+
product_family_id: acme_projects.id,
|
652
|
+
name: 'CODE 1',
|
653
|
+
code: 'CODE1',
|
654
|
+
description: 'a coupon',
|
655
|
+
percentage: 10,
|
656
|
+
stackable: true
|
657
|
+
)
|
658
|
+
end
|
659
|
+
|
660
|
+
context 'when a subscription has a single coupon' do
|
661
|
+
|
662
|
+
let(:subscription) do
|
663
|
+
Chargify::Subscription.create(
|
664
|
+
:product_handle => pro_plan.handle,
|
665
|
+
:customer_reference => johnadoe.reference,
|
666
|
+
:payment_profile_attributes => good_payment_profile_attributes,
|
667
|
+
:coupon_codes => coupon1.code
|
668
|
+
)
|
669
|
+
end
|
670
|
+
|
671
|
+
it 'removes the coupon when a code is provided' do
|
672
|
+
subscription.remove_coupon('CODE1')
|
673
|
+
subscription.reload
|
674
|
+
|
675
|
+
expect(subscription.coupon_code).to be_nil
|
676
|
+
end
|
677
|
+
|
678
|
+
it 'removes the coupon without a code' do
|
679
|
+
subscription.remove_coupon
|
680
|
+
subscription.reload
|
681
|
+
|
682
|
+
expect(subscription.coupon_code).to be_nil
|
683
|
+
end
|
684
|
+
|
685
|
+
it 'does not remove the coupon given a mismatched code' do
|
686
|
+
subscription.remove_coupon('NOT_A_CODE')
|
687
|
+
subscription.reload
|
688
|
+
|
689
|
+
expect(subscription.coupon_code).to eq 'CODE1'
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
context 'when a subscription has multiple coupons' do
|
694
|
+
let(:coupon2) do
|
695
|
+
Chargify::Coupon.create(
|
696
|
+
product_family_id: acme_projects.id,
|
697
|
+
name: 'CODE 2',
|
698
|
+
code: 'CODE2',
|
699
|
+
description: 'another coupon',
|
700
|
+
percentage: 10,
|
701
|
+
stackable: true
|
702
|
+
)
|
703
|
+
end
|
704
|
+
|
705
|
+
let(:subscription) do
|
706
|
+
Chargify::Subscription.create(
|
707
|
+
:product_handle => pro_plan.handle,
|
708
|
+
:customer_reference => johnadoe.reference,
|
709
|
+
:payment_profile_attributes => good_payment_profile_attributes,
|
710
|
+
:coupon_codes => [coupon1.code, coupon2.code]
|
711
|
+
)
|
712
|
+
end
|
713
|
+
|
714
|
+
it 'does not remove any coupons without a code' do
|
715
|
+
subscription.remove_coupon
|
716
|
+
subscription.reload
|
717
|
+
|
718
|
+
expect(subscription.coupon_codes).to eq ['CODE1', 'CODE2']
|
719
|
+
end
|
720
|
+
|
721
|
+
it 'removes the specified coupon when a code is given' do
|
722
|
+
subscription.remove_coupon('CODE1')
|
723
|
+
subscription.reload
|
724
|
+
|
725
|
+
expect(subscription.coupon_codes).to eq ['CODE2']
|
726
|
+
end
|
727
|
+
end
|
728
|
+
end
|
729
|
+
|
648
730
|
describe "adding a refund" do
|
649
731
|
before(:all) do
|
650
732
|
@subscription = Chargify::Subscription.create(
|
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.15
|
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:
|
11
|
+
date: 2018-06-20 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.7.6
|
274
274
|
signing_key:
|
275
275
|
specification_version: 3
|
276
276
|
summary: A Chargify API wrapper for Ruby using ActiveResource
|