chargebee 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/chargebee.gemspec +5 -2
- data/lib/chargebee.rb +4 -1
- data/lib/chargebee/models/addon.rb +18 -0
- data/lib/chargebee/models/coupon.rb +20 -0
- data/lib/chargebee/models/event.rb +10 -0
- data/lib/chargebee/models/plan.rb +19 -0
- data/lib/chargebee/models/subscription.rb +2 -2
- data/lib/chargebee/models/transaction.rb +3 -2
- data/lib/chargebee/result.rb +12 -0
- metadata +5 -2
data/chargebee.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'chargebee'
|
7
|
-
s.version = '1.0.
|
8
|
-
s.date = '2012-
|
7
|
+
s.version = '1.0.4'
|
8
|
+
s.date = '2012-06-19'
|
9
9
|
|
10
10
|
s.summary = "Ruby client for Chargebee API."
|
11
11
|
s.description = "Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com."
|
@@ -37,13 +37,16 @@ Gem::Specification.new do |s|
|
|
37
37
|
lib/chargebee/environment.rb
|
38
38
|
lib/chargebee/list_result.rb
|
39
39
|
lib/chargebee/model.rb
|
40
|
+
lib/chargebee/models/addon.rb
|
40
41
|
lib/chargebee/models/address.rb
|
41
42
|
lib/chargebee/models/card.rb
|
43
|
+
lib/chargebee/models/coupon.rb
|
42
44
|
lib/chargebee/models/customer.rb
|
43
45
|
lib/chargebee/models/event.rb
|
44
46
|
lib/chargebee/models/hosted_page.rb
|
45
47
|
lib/chargebee/models/invoice.rb
|
46
48
|
lib/chargebee/models/model.rb
|
49
|
+
lib/chargebee/models/plan.rb
|
47
50
|
lib/chargebee/models/subscription.rb
|
48
51
|
lib/chargebee/models/transaction.rb
|
49
52
|
lib/chargebee/request.rb
|
data/lib/chargebee.rb
CHANGED
@@ -16,11 +16,14 @@ require File.dirname(__FILE__) + '/chargebee/models/transaction'
|
|
16
16
|
require File.dirname(__FILE__) + '/chargebee/models/invoice'
|
17
17
|
require File.dirname(__FILE__) + '/chargebee/models/hosted_page'
|
18
18
|
require File.dirname(__FILE__) + '/chargebee/models/event'
|
19
|
+
require File.dirname(__FILE__) + '/chargebee/models/plan'
|
20
|
+
require File.dirname(__FILE__) + '/chargebee/models/addon'
|
21
|
+
require File.dirname(__FILE__) + '/chargebee/models/coupon'
|
19
22
|
|
20
23
|
|
21
24
|
module ChargeBee
|
22
25
|
|
23
|
-
VERSION = '1.0.
|
26
|
+
VERSION = '1.0.4'
|
24
27
|
|
25
28
|
@@default_env = nil
|
26
29
|
@@verify_ca_certs = true
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class Addon < Model
|
3
|
+
|
4
|
+
attr_accessor :id, :name, :invoice_name, :type, :charge_type, :price, :unit, :status, :archived_at
|
5
|
+
|
6
|
+
# OPERATIONS
|
7
|
+
#-----------
|
8
|
+
|
9
|
+
def self.list(params={}, env=nil)
|
10
|
+
Request.send('get', "/addons", params, env)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.retrieve(id, env=nil)
|
14
|
+
Request.send('get', "/addons/#{id.to_s}", {}, env)
|
15
|
+
end
|
16
|
+
|
17
|
+
end # ~Addon
|
18
|
+
end # ~ChargeBee
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class Coupon < Model
|
3
|
+
|
4
|
+
attr_accessor :id, :name, :invoice_name, :discount_type, :discount_percentage, :discount_amount,
|
5
|
+
:duration_type, :duration_month, :max_redemptions, :status, :redemptions, :apply_discount_on,
|
6
|
+
:created_at, :archived_at, :valid_till
|
7
|
+
|
8
|
+
# OPERATIONS
|
9
|
+
#-----------
|
10
|
+
|
11
|
+
def self.list(params={}, env=nil)
|
12
|
+
Request.send('get', "/coupons", params, env)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.retrieve(id, env=nil)
|
16
|
+
Request.send('get', "/coupons/#{id.to_s}", {}, env)
|
17
|
+
end
|
18
|
+
|
19
|
+
end # ~Coupon
|
20
|
+
end # ~ChargeBee
|
@@ -10,6 +10,16 @@ module ChargeBee
|
|
10
10
|
Content.new(@values[:content])
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.deserialize(json)
|
14
|
+
begin
|
15
|
+
webhook_data = JSON.parse(json)
|
16
|
+
rescue JSON::ParserError
|
17
|
+
raise APIError.new("Invalid webhook object to deserialize")
|
18
|
+
end
|
19
|
+
webhook_data = Util.symbolize_keys(webhook_data)
|
20
|
+
Event.construct(webhook_data)
|
21
|
+
end
|
22
|
+
|
13
23
|
# OPERATIONS
|
14
24
|
#-----------
|
15
25
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class Plan < Model
|
3
|
+
|
4
|
+
attr_accessor :id, :name, :invoice_name, :price, :period_unit, :trial_period, :trial_period_unit,
|
5
|
+
:setup_cost, :status, :archived_at
|
6
|
+
|
7
|
+
# OPERATIONS
|
8
|
+
#-----------
|
9
|
+
|
10
|
+
def self.list(params={}, env=nil)
|
11
|
+
Request.send('get', "/plans", params, env)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.retrieve(id, env=nil)
|
15
|
+
Request.send('get', "/plans/#{id.to_s}", {}, env)
|
16
|
+
end
|
17
|
+
|
18
|
+
end # ~Plan
|
19
|
+
end # ~ChargeBee
|
@@ -6,8 +6,8 @@ module ChargeBee
|
|
6
6
|
end
|
7
7
|
|
8
8
|
attr_accessor :id, :plan_id, :plan_quantity, :status, :trial_start, :trial_end, :current_term_start,
|
9
|
-
:current_term_end, :created_at, :activated_at, :cancelled_at, :
|
10
|
-
:total_dues, :addons, :coupon
|
9
|
+
:current_term_end, :created_at, :activated_at, :cancelled_at, :cancel_reason, :due_invoices_count,
|
10
|
+
:due_since, :total_dues, :addons, :coupon
|
11
11
|
|
12
12
|
# OPERATIONS
|
13
13
|
#-----------
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Transaction < Model
|
3
3
|
|
4
|
-
attr_accessor :id, :subscription_id, :gateway, :invoice_id, :type, :date, :amount,
|
5
|
-
:masked_card_number, :error_code, :error_text, :refunded_tx_id, :
|
4
|
+
attr_accessor :id, :subscription_id, :gateway, :description, :invoice_id, :type, :date, :amount,
|
5
|
+
:id_at_gateway, :masked_card_number, :error_code, :error_text, :refunded_tx_id, :voided_at,
|
6
|
+
:status
|
6
7
|
|
7
8
|
# OPERATIONS
|
8
9
|
#-----------
|
data/lib/chargebee/result.rb
CHANGED
@@ -37,6 +37,18 @@ module ChargeBee
|
|
37
37
|
get(:hosted_page, HostedPage)
|
38
38
|
end
|
39
39
|
|
40
|
+
def plan()
|
41
|
+
get(:plan, Plan)
|
42
|
+
end
|
43
|
+
|
44
|
+
def addon()
|
45
|
+
get(:addon, Addon)
|
46
|
+
end
|
47
|
+
|
48
|
+
def coupon()
|
49
|
+
get(:coupon, Coupon)
|
50
|
+
end
|
51
|
+
|
40
52
|
def to_s(*args)
|
41
53
|
JSON.pretty_generate(@response)
|
42
54
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: chargebee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rajaraman S
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-06-19 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json_pure
|
@@ -78,13 +78,16 @@ files:
|
|
78
78
|
- lib/chargebee/environment.rb
|
79
79
|
- lib/chargebee/list_result.rb
|
80
80
|
- lib/chargebee/model.rb
|
81
|
+
- lib/chargebee/models/addon.rb
|
81
82
|
- lib/chargebee/models/address.rb
|
82
83
|
- lib/chargebee/models/card.rb
|
84
|
+
- lib/chargebee/models/coupon.rb
|
83
85
|
- lib/chargebee/models/customer.rb
|
84
86
|
- lib/chargebee/models/event.rb
|
85
87
|
- lib/chargebee/models/hosted_page.rb
|
86
88
|
- lib/chargebee/models/invoice.rb
|
87
89
|
- lib/chargebee/models/model.rb
|
90
|
+
- lib/chargebee/models/plan.rb
|
88
91
|
- lib/chargebee/models/subscription.rb
|
89
92
|
- lib/chargebee/models/transaction.rb
|
90
93
|
- lib/chargebee/request.rb
|