chargify_api_ares 1.4.3 → 1.4.4

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: 3b4fea9191725abc5d611228e64fc1d1c73e85f9
4
- data.tar.gz: b9d5ff10e502d79443298f550a39abce9fca60e4
3
+ metadata.gz: 69aa3faec2b2f60e39558318a569ece38bb66187
4
+ data.tar.gz: cb7a28a0c2fc9e08987403d00a129f77fe95956e
5
5
  SHA512:
6
- metadata.gz: f087abf32692cdcd9fd417a549f9521dd5fb1f32cc83cddff01209928bd518e78eb5ca5eae237802916d2b9f3a5d403fa15859af3f2a57bc1a6014f41f1e8ee6
7
- data.tar.gz: 04218486fb72dcede36967a1bf49a677203387ee896209149e6d9f944ead7f12e2bf57e1f2c4e020323e3b9910cd40cb04d69ab51c5ab527c09289bd1b9ecc9a
6
+ metadata.gz: bef28b56c1a06782277d81435154ab1eb9e920b8dcc31c483d95024ae183e75e3b45b6b44c9a5b63be5a839f9426b81b4fed99b7157bed9eb555e9fdc163597f
7
+ data.tar.gz: e3b8d2728765d432d5ef3dde3378af5ab8bfc97b52e28d98b8899917b94d9d3fa99f8e8d86ecd3ab4993d607a4e5b8987160a480102478d40e446be24012276a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chargify_api_ares (1.4.3)
4
+ chargify_api_ares (1.4.4)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.4.4 / Jun 3 2016
2
+
3
+ * Adds support for External Payments [PR 128](https://github.com/chargify/chargify_api_ares/pull/128)
4
+
1
5
  ## 1.4.3 / Jan 5 2016
2
6
 
3
7
  * Force json format for bulk allocations endpoints [PR 126](https://github.com/chargify/chargify_api_ares/pull/126) by @ryansch
@@ -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.3'
8
- s.date = '2016-01-05'
7
+ s.version = '1.4.4'
8
+ s.date = '2016-06-03'
9
9
  s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
10
10
  s.description = ''
11
11
  s.authors = ["Chargify Development Team"]
@@ -0,0 +1,24 @@
1
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
3
+ require "chargify_api_ares"
4
+
5
+ Chargify.configure do |c|
6
+ c.subdomain = ENV['CHARGIFY_SUBDOMAIN']
7
+ c.api_key = ENV['CHARGIFY_API_KEY']
8
+ end
9
+
10
+ # Find a Chargify Subscription
11
+ sub = Chargify::Subscription.find_by_customer_reference 'abc-123-def-456'
12
+
13
+ # Record an external payment on the Chargify Subscription
14
+ pmt = sub.payment(
15
+ amount_in_cents: 2500,
16
+ memo: "Pre-payment for..."
17
+ )
18
+
19
+ # Or, create the external payment directly:
20
+ pmt = Chargify::Payment.create(
21
+ subscription_id: sub.id,
22
+ amount_in_cents: 2500,
23
+ memo: "Pre-payment for..."
24
+ )
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.4.3)
4
+ chargify_api_ares (1.4.4)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.4.3)
4
+ chargify_api_ares (1.4.4)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.4.3)
4
+ chargify_api_ares (1.4.4)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -12,6 +12,7 @@ require 'chargify_api_ares/resources/customer_metadata'
12
12
  require 'chargify_api_ares/resources/customer'
13
13
  require 'chargify_api_ares/resources/event'
14
14
  require 'chargify_api_ares/resources/migration'
15
+ require 'chargify_api_ares/resources/payment'
15
16
  require 'chargify_api_ares/resources/payment_profile'
16
17
  require 'chargify_api_ares/resources/product'
17
18
  require 'chargify_api_ares/resources/product_family'
@@ -36,5 +36,11 @@ module Chargify
36
36
  connection.format = orig_format
37
37
  end
38
38
  end
39
+
40
+ # Needed to avoid ActiveResource using Chargify::Payment
41
+ # when there is a Payment inside an Allocation.
42
+ # This Payment is an output-only attribute of an Allocation.
43
+ class Payment < Base
44
+ end
39
45
  end
40
46
  end
@@ -0,0 +1,7 @@
1
+ module Chargify
2
+ class Payment < Base
3
+ include ResponseHelper
4
+
5
+ self.prefix = '/subscriptions/:subscription_id/'
6
+ end
7
+ end
@@ -74,6 +74,14 @@ module Chargify
74
74
  Chargify::Charge.create(attrs.merge(:subscription_id => self.id))
75
75
  end
76
76
 
77
+ # Record an external payment on an existing subscription.
78
+ # This DOES NOT charge the customer's credit card.
79
+ # For more information, please see the API docs available
80
+ # at: https://docs.chargify.com/api-payments
81
+ def payment(attrs = {})
82
+ Chargify::Payment.create(attrs.merge(:subscription_id => self.id))
83
+ end
84
+
77
85
  def credit(attrs = {})
78
86
  attrs, options = extract_uniqueness_token(attrs)
79
87
  process_capturing_errors 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.3
4
+ version: 1.4.4
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: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -176,6 +176,7 @@ files:
176
176
  - examples/metafields.rb
177
177
  - examples/metered_components.rb
178
178
  - examples/migrations.rb
179
+ - examples/payments.rb
179
180
  - examples/products.rb
180
181
  - examples/renewal_preview.rb
181
182
  - examples/subscriptions.rb
@@ -202,6 +203,7 @@ files:
202
203
  - lib/chargify_api_ares/resources/event.rb
203
204
  - lib/chargify_api_ares/resources/invoice.rb
204
205
  - lib/chargify_api_ares/resources/migration.rb
206
+ - lib/chargify_api_ares/resources/payment.rb
205
207
  - lib/chargify_api_ares/resources/payment_profile.rb
206
208
  - lib/chargify_api_ares/resources/product.rb
207
209
  - lib/chargify_api_ares/resources/product_family.rb