chargebee 1.7.5 → 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1114 -98
- data/LICENSE +1 -1
- data/README.rdoc +22 -15
- data/chargebee.gemspec +27 -7
- data/lib/.DS_Store +0 -0
- data/lib/chargebee.rb +28 -2
- data/lib/chargebee/environment.rb +11 -6
- data/lib/chargebee/errors.rb +1 -1
- data/lib/chargebee/models/addon.rb +18 -3
- data/lib/chargebee/models/address.rb +1 -1
- data/lib/chargebee/models/card.rb +8 -7
- data/lib/chargebee/models/comment.rb +1 -1
- data/lib/chargebee/models/contact.rb +11 -0
- data/lib/chargebee/models/coupon.rb +20 -4
- data/lib/chargebee/models/coupon_code.rb +9 -1
- data/lib/chargebee/models/coupon_set.rb +38 -0
- data/lib/chargebee/models/credit_note.rb +79 -0
- data/lib/chargebee/models/credit_note_estimate.rb +36 -0
- data/lib/chargebee/models/customer.rb +73 -12
- data/lib/chargebee/models/estimate.rb +26 -15
- data/lib/chargebee/models/event.rb +1 -1
- data/lib/chargebee/models/export.rb +87 -0
- data/lib/chargebee/models/gift.rb +43 -0
- data/lib/chargebee/models/hierarchy.rb +10 -0
- data/lib/chargebee/models/hosted_page.rb +33 -5
- data/lib/chargebee/models/invoice.rb +83 -19
- data/lib/chargebee/models/invoice_estimate.rb +36 -0
- data/lib/chargebee/models/model.rb +34 -3
- data/lib/chargebee/models/order.rb +49 -3
- data/lib/chargebee/models/payment_source.rb +84 -0
- data/lib/chargebee/models/plan.rb +33 -5
- data/lib/chargebee/models/promotional_credit.rb +31 -0
- data/lib/chargebee/models/quote.rb +77 -0
- data/lib/chargebee/models/resource_migration.rb +14 -0
- data/lib/chargebee/models/site_migration_detail.rb +15 -0
- data/lib/chargebee/models/subscription.rb +60 -8
- data/lib/chargebee/models/subscription_estimate.rb +14 -0
- data/lib/chargebee/models/third_party_payment_method.rb +10 -0
- data/lib/chargebee/models/time_machine.rb +47 -0
- data/lib/chargebee/models/token.rb +11 -0
- data/lib/chargebee/models/transaction.rb +29 -10
- data/lib/chargebee/models/unbilled_charge.rb +32 -0
- data/lib/chargebee/models/virtual_bank_account.rb +32 -0
- data/lib/chargebee/request.rb +11 -0
- data/lib/chargebee/rest.rb +6 -4
- data/lib/chargebee/result.rb +183 -27
- data/spec/errors_spec.rb +23 -0
- data/spec/sample_response.rb +1 -1
- metadata +39 -11
- data/lib/chargebee/models/payment_intent.rb +0 -27
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,32 +1,39 @@
|
|
1
|
-
= Chargebee Ruby Client Library - API
|
1
|
+
= Chargebee Ruby Client Library - API V2
|
2
2
|
|
3
|
-
|
3
|
+
{<img src="https://img.shields.io/gem/v/chargebee.svg?maxAge=2592000"/>}[https://rubygems.org/gems/chargebee]
|
4
|
+
{<img src="https://img.shields.io/gem/dtv/chargebee.svg?maxAge=2592000"/>}[https://rubygems.org/gems/chargebee]
|
4
5
|
|
5
|
-
|
6
|
+
This is the Ruby Library for integrating with Chargebee. Sign up for a Chargebee account {here}[https://www.chargebee.com].
|
6
7
|
|
7
|
-
|
8
|
+
Chargebee now supports two API versions - {V1}[https://apidocs.chargebee.com/docs/api/v1] and {V2}[https://apidocs.chargebee.com/docs/api], of which V2 is the latest release and all future developments will happen in V2. This library is for <b>API version V2</b>. If you’re looking for V1, head to {chargebee-v1 branch}[https://github.com/chargebee/chargebee-ruby/tree/chargebee-v1].
|
8
9
|
|
9
10
|
== Installation
|
10
11
|
|
11
12
|
Install the latest version of the gem with the following command...
|
12
|
-
|
13
|
-
$ sudo gem install chargebee -v '~>
|
13
|
+
|
14
|
+
$ sudo gem install chargebee -v '~>2'
|
15
|
+
|
16
|
+
|
17
|
+
== Requirements
|
18
|
+
|
19
|
+
* Ruby 1.9.3 or above.
|
20
|
+
* rest-client
|
14
21
|
|
15
22
|
== Documentation
|
16
23
|
|
17
|
-
For API reference see {here}[https://apidocs.chargebee.com/docs/api
|
24
|
+
For API reference see {here}[https://apidocs.chargebee.com/docs/api?lang=ruby]
|
18
25
|
|
19
26
|
== Usage
|
20
27
|
|
21
28
|
To create a new subscription:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
|
30
|
+
ChargeBee.configure({:api_key => "your_api_key" , :site => "your_site"})
|
31
|
+
result = ChargeBee::Subscription.create({
|
32
|
+
:id => "sub_KyVqDh__dev__NTn4VZZ1",
|
33
|
+
:plan_id => "basic",
|
34
|
+
})
|
35
|
+
subscription = result.subscription
|
36
|
+
puts "created subscription is #{subscription}"
|
30
37
|
|
31
38
|
== License
|
32
39
|
|
data/chargebee.gemspec
CHANGED
@@ -2,10 +2,10 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
|
-
|
5
|
+
s.required_ruby_version = '>= 1.9.3'
|
6
6
|
s.name = 'chargebee'
|
7
|
-
s.version = '
|
8
|
-
s.date = '2019-08-
|
7
|
+
s.version = '2.6.8'
|
8
|
+
s.date = '2019-08-07'
|
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."
|
@@ -13,15 +13,15 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.authors = ['Rajaraman S', 'Thiyagarajan T']
|
14
14
|
s.email = ['rr@chargebee.com', 'thiyagu@chargebee.com']
|
15
15
|
s.homepage = 'https://apidocs.chargebee.com/api/docs?lang=ruby'
|
16
|
-
|
16
|
+
s.license = 'MIT'
|
17
17
|
|
18
18
|
s.require_paths = %w[lib]
|
19
19
|
|
20
20
|
s.rdoc_options = ["--charset=UTF-8"]
|
21
21
|
s.extra_rdoc_files = %w[README.rdoc LICENSE]
|
22
22
|
|
23
|
-
s.add_dependency('json_pure', '~> 1
|
24
|
-
s.add_dependency('rest-client', '
|
23
|
+
s.add_dependency('json_pure', '~> 2.1')
|
24
|
+
s.add_dependency('rest-client', '>= 1.8', '< 3.0')
|
25
25
|
|
26
26
|
s.add_development_dependency('rspec', '~> 3.0.0')
|
27
27
|
s.add_development_dependency('mocha')
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
README.rdoc
|
34
34
|
Rakefile
|
35
35
|
chargebee.gemspec
|
36
|
+
lib/.DS_Store
|
36
37
|
lib/chargebee.rb
|
37
38
|
lib/chargebee/environment.rb
|
38
39
|
lib/chargebee/errors.rb
|
@@ -41,21 +42,39 @@ Gem::Specification.new do |s|
|
|
41
42
|
lib/chargebee/models/address.rb
|
42
43
|
lib/chargebee/models/card.rb
|
43
44
|
lib/chargebee/models/comment.rb
|
45
|
+
lib/chargebee/models/contact.rb
|
44
46
|
lib/chargebee/models/coupon.rb
|
45
47
|
lib/chargebee/models/coupon_code.rb
|
48
|
+
lib/chargebee/models/coupon_set.rb
|
49
|
+
lib/chargebee/models/credit_note.rb
|
50
|
+
lib/chargebee/models/credit_note_estimate.rb
|
46
51
|
lib/chargebee/models/customer.rb
|
47
52
|
lib/chargebee/models/download.rb
|
48
53
|
lib/chargebee/models/estimate.rb
|
49
54
|
lib/chargebee/models/event.rb
|
55
|
+
lib/chargebee/models/export.rb
|
56
|
+
lib/chargebee/models/gift.rb
|
57
|
+
lib/chargebee/models/hierarchy.rb
|
50
58
|
lib/chargebee/models/hosted_page.rb
|
51
59
|
lib/chargebee/models/invoice.rb
|
60
|
+
lib/chargebee/models/invoice_estimate.rb
|
52
61
|
lib/chargebee/models/model.rb
|
53
62
|
lib/chargebee/models/order.rb
|
54
|
-
lib/chargebee/models/
|
63
|
+
lib/chargebee/models/payment_source.rb
|
55
64
|
lib/chargebee/models/plan.rb
|
56
65
|
lib/chargebee/models/portal_session.rb
|
66
|
+
lib/chargebee/models/promotional_credit.rb
|
67
|
+
lib/chargebee/models/quote.rb
|
68
|
+
lib/chargebee/models/resource_migration.rb
|
69
|
+
lib/chargebee/models/site_migration_detail.rb
|
57
70
|
lib/chargebee/models/subscription.rb
|
71
|
+
lib/chargebee/models/subscription_estimate.rb
|
72
|
+
lib/chargebee/models/third_party_payment_method.rb
|
73
|
+
lib/chargebee/models/time_machine.rb
|
74
|
+
lib/chargebee/models/token.rb
|
58
75
|
lib/chargebee/models/transaction.rb
|
76
|
+
lib/chargebee/models/unbilled_charge.rb
|
77
|
+
lib/chargebee/models/virtual_bank_account.rb
|
59
78
|
lib/chargebee/request.rb
|
60
79
|
lib/chargebee/rest.rb
|
61
80
|
lib/chargebee/result.rb
|
@@ -63,6 +82,7 @@ Gem::Specification.new do |s|
|
|
63
82
|
lib/ssl/ca-certs.crt
|
64
83
|
spec/chargebee/list_result_spec.rb
|
65
84
|
spec/chargebee_spec.rb
|
85
|
+
spec/errors_spec.rb
|
66
86
|
spec/sample_response.rb
|
67
87
|
spec/spec_helper.rb
|
68
88
|
]
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/chargebee.rb
CHANGED
@@ -11,29 +11,46 @@ require File.dirname(__FILE__) + '/chargebee/models/model'
|
|
11
11
|
require File.dirname(__FILE__) + '/chargebee/models/subscription'
|
12
12
|
require File.dirname(__FILE__) + '/chargebee/models/customer'
|
13
13
|
require File.dirname(__FILE__) + '/chargebee/models/card'
|
14
|
+
require File.dirname(__FILE__) + '/chargebee/models/third_party_payment_method'
|
14
15
|
require File.dirname(__FILE__) + '/chargebee/models/address'
|
15
16
|
require File.dirname(__FILE__) + '/chargebee/models/transaction'
|
16
17
|
require File.dirname(__FILE__) + '/chargebee/models/invoice'
|
17
18
|
require File.dirname(__FILE__) + '/chargebee/models/order'
|
19
|
+
require File.dirname(__FILE__) + '/chargebee/models/credit_note'
|
18
20
|
require File.dirname(__FILE__) + '/chargebee/models/estimate'
|
21
|
+
require File.dirname(__FILE__) + '/chargebee/models/subscription_estimate'
|
22
|
+
require File.dirname(__FILE__) + '/chargebee/models/invoice_estimate'
|
23
|
+
require File.dirname(__FILE__) + '/chargebee/models/credit_note_estimate'
|
19
24
|
require File.dirname(__FILE__) + '/chargebee/models/hosted_page'
|
20
25
|
require File.dirname(__FILE__) + '/chargebee/models/event'
|
21
26
|
require File.dirname(__FILE__) + '/chargebee/models/plan'
|
22
27
|
require File.dirname(__FILE__) + '/chargebee/models/addon'
|
23
28
|
require File.dirname(__FILE__) + '/chargebee/models/coupon'
|
24
29
|
require File.dirname(__FILE__) + '/chargebee/models/coupon_code'
|
30
|
+
require File.dirname(__FILE__) + '/chargebee/models/coupon_set'
|
25
31
|
require File.dirname(__FILE__) + '/chargebee/models/comment'
|
26
32
|
require File.dirname(__FILE__) + '/chargebee/models/portal_session'
|
27
33
|
require File.dirname(__FILE__) + '/chargebee/models/download'
|
28
|
-
require File.dirname(__FILE__) + '/chargebee/models/
|
34
|
+
require File.dirname(__FILE__) + '/chargebee/models/site_migration_detail'
|
35
|
+
require File.dirname(__FILE__) + '/chargebee/models/resource_migration'
|
36
|
+
require File.dirname(__FILE__) + '/chargebee/models/payment_source'
|
37
|
+
require File.dirname(__FILE__) + '/chargebee/models/unbilled_charge'
|
38
|
+
require File.dirname(__FILE__) + '/chargebee/models/time_machine'
|
39
|
+
require File.dirname(__FILE__) + '/chargebee/models/promotional_credit.rb'
|
40
|
+
require File.dirname(__FILE__) + '/chargebee/models/virtual_bank_account.rb'
|
41
|
+
require File.dirname(__FILE__) + '/chargebee/models/export'
|
42
|
+
require File.dirname(__FILE__) + '/chargebee/models/gift'
|
43
|
+
require File.dirname(__FILE__) + '/chargebee/models/quote'
|
44
|
+
require File.dirname(__FILE__) + '/chargebee/models/contact.rb'
|
29
45
|
|
30
46
|
module ChargeBee
|
31
47
|
|
32
|
-
VERSION = '
|
48
|
+
VERSION = '2.6.8'
|
33
49
|
|
34
50
|
@@default_env = nil
|
35
51
|
@@verify_ca_certs = true
|
36
52
|
@@ca_cert_path = File.join(File.dirname(__FILE__), '/ssl/ca-certs.crt')
|
53
|
+
@@user_agent = "Chargebee-Ruby-Client v#{self::VERSION}"
|
37
54
|
|
38
55
|
def self.configure(options)
|
39
56
|
@@default_env = Environment.new(options)
|
@@ -55,5 +72,14 @@ module ChargeBee
|
|
55
72
|
@@ca_cert_path
|
56
73
|
end
|
57
74
|
|
75
|
+
|
76
|
+
def self.source(source)
|
77
|
+
@@user_agent = @@user_agent + ' ' + source unless source.nil?
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.user_agent
|
81
|
+
@@user_agent
|
82
|
+
end
|
83
|
+
|
58
84
|
end
|
59
85
|
|
@@ -1,11 +1,17 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Environment
|
3
|
-
API_VERSION = "
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
API_VERSION = "v2"
|
4
|
+
# in seconds
|
5
|
+
TIME_MACHINE_TIMEOUT = 3
|
6
|
+
EXPORT_TIMEOUT = 10
|
7
|
+
|
8
|
+
attr_accessor :api_key, :site, :time_machine_sleeptime, :export_sleeptime
|
9
|
+
attr_reader :api_endpoint
|
10
|
+
|
7
11
|
def initialize(options)
|
8
|
-
[:
|
12
|
+
options[:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT
|
13
|
+
options[:export_sleeptime] ||= EXPORT_TIMEOUT
|
14
|
+
[:api_key, :site, :time_machine_sleeptime, :export_sleeptime].each do |attr|
|
9
15
|
instance_variable_set "@#{attr}", options[attr]
|
10
16
|
end
|
11
17
|
if($CHARGEBEE_DOMAIN == nil)
|
@@ -18,6 +24,5 @@ module ChargeBee
|
|
18
24
|
def api_url(url)
|
19
25
|
url = @api_endpoint + url
|
20
26
|
end
|
21
|
-
|
22
27
|
end
|
23
28
|
end
|
data/lib/chargebee/errors.rb
CHANGED
@@ -13,7 +13,7 @@ module ChargeBee
|
|
13
13
|
|
14
14
|
class APIError < Error
|
15
15
|
|
16
|
-
attr_reader :http_status_code, :
|
16
|
+
attr_reader :http_status_code, :type, :api_error_code, :param, :json_obj,
|
17
17
|
#Deprecated attributes
|
18
18
|
:http_code, :http_body, :error_code
|
19
19
|
|
@@ -1,8 +1,15 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Addon < Model
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
class Tier < Model
|
5
|
+
attr_accessor :starting_unit, :ending_unit, :price
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :id, :name, :invoice_name, :description, :pricing_model, :type, :charge_type,
|
9
|
+
:price, :currency_code, :period, :period_unit, :unit, :status, :archived_at, :enabled_in_portal,
|
10
|
+
:tax_code, :avalara_sale_type, :avalara_transaction_type, :avalara_service_type, :sku, :accounting_code,
|
11
|
+
:accounting_category1, :accounting_category2, :is_shippable, :shipping_frequency_period, :shipping_frequency_period_unit,
|
12
|
+
:resource_version, :updated_at, :invoice_notes, :taxable, :tax_profile_id, :meta_data, :tiers
|
6
13
|
|
7
14
|
# OPERATIONS
|
8
15
|
#-----------
|
@@ -16,7 +23,7 @@ module ChargeBee
|
|
16
23
|
end
|
17
24
|
|
18
25
|
def self.list(params={}, env=nil, headers={})
|
19
|
-
Request.
|
26
|
+
Request.send_list_request('get', uri_path("addons"), params, env, headers)
|
20
27
|
end
|
21
28
|
|
22
29
|
def self.retrieve(id, env=nil, headers={})
|
@@ -27,5 +34,13 @@ module ChargeBee
|
|
27
34
|
Request.send('post', uri_path("addons",id.to_s,"delete"), {}, env, headers)
|
28
35
|
end
|
29
36
|
|
37
|
+
def self.copy(params, env=nil, headers={})
|
38
|
+
Request.send('post', uri_path("addons","copy"), params, env, headers)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.unarchive(id, env=nil, headers={})
|
42
|
+
Request.send('post', uri_path("addons",id.to_s,"unarchive"), {}, env, headers)
|
43
|
+
end
|
44
|
+
|
30
45
|
end # ~Addon
|
31
46
|
end # ~ChargeBee
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class Address < Model
|
3
3
|
|
4
4
|
attr_accessor :label, :first_name, :last_name, :email, :company, :phone, :addr, :extended_addr,
|
5
|
-
:extended_addr2, :city, :state_code, :state, :country, :zip, :subscription_id
|
5
|
+
:extended_addr2, :city, :state_code, :state, :country, :zip, :validation_status, :subscription_id
|
6
6
|
|
7
7
|
# OPERATIONS
|
8
8
|
#-----------
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Card < Model
|
3
3
|
|
4
|
-
attr_accessor :
|
5
|
-
:
|
6
|
-
:
|
4
|
+
attr_accessor :payment_source_id, :status, :gateway, :gateway_account_id, :ref_tx_id, :first_name,
|
5
|
+
:last_name, :iin, :last4, :card_type, :funding_type, :expiry_month, :expiry_year, :issuing_country,
|
6
|
+
:billing_addr1, :billing_addr2, :billing_city, :billing_state_code, :billing_state, :billing_country,
|
7
|
+
:billing_zip, :created_at, :resource_version, :updated_at, :ip_address, :customer_id, :masked_number
|
7
8
|
|
8
9
|
# OPERATIONS
|
9
10
|
#-----------
|
@@ -16,14 +17,14 @@ module ChargeBee
|
|
16
17
|
Request.send('post', uri_path("customers",id.to_s,"credit_card"), params, env, headers)
|
17
18
|
end
|
18
19
|
|
19
|
-
def self.update_card_for_customer_using_payment_intent(id, params={}, env=nil, headers={})
|
20
|
-
Request.send('post', uri_path("customers",id.to_s,"credit_card_using_payment_intent"), params, env, headers)
|
21
|
-
end
|
22
|
-
|
23
20
|
def self.switch_gateway_for_customer(id, params, env=nil, headers={})
|
24
21
|
Request.send('post', uri_path("customers",id.to_s,"switch_gateway"), params, env, headers)
|
25
22
|
end
|
26
23
|
|
24
|
+
def self.copy_card_for_customer(id, params, env=nil, headers={})
|
25
|
+
Request.send('post', uri_path("customers",id.to_s,"copy_card"), params, env, headers)
|
26
|
+
end
|
27
|
+
|
27
28
|
def self.delete_card_for_customer(id, env=nil, headers={})
|
28
29
|
Request.send('post', uri_path("customers",id.to_s,"delete_card"), {}, env, headers)
|
29
30
|
end
|
@@ -15,7 +15,7 @@ module ChargeBee
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.list(params={}, env=nil, headers={})
|
18
|
-
Request.
|
18
|
+
Request.send_list_request('get', uri_path("comments"), params, env, headers)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.delete(id, env=nil, headers={})
|
@@ -2,9 +2,9 @@ module ChargeBee
|
|
2
2
|
class Coupon < Model
|
3
3
|
|
4
4
|
attr_accessor :id, :name, :invoice_name, :discount_type, :discount_percentage, :discount_amount,
|
5
|
-
:discount_quantity, :duration_type, :duration_month, :valid_till, :max_redemptions,
|
6
|
-
:apply_discount_on, :apply_on, :plan_constraint, :addon_constraint, :created_at, :archived_at,
|
7
|
-
:plan_ids, :addon_ids, :redemptions, :invoice_notes, :meta_data
|
5
|
+
:discount_quantity, :currency_code, :duration_type, :duration_month, :valid_till, :max_redemptions,
|
6
|
+
:status, :apply_discount_on, :apply_on, :plan_constraint, :addon_constraint, :created_at, :archived_at,
|
7
|
+
:resource_version, :updated_at, :plan_ids, :addon_ids, :redemptions, :invoice_notes, :meta_data
|
8
8
|
|
9
9
|
# OPERATIONS
|
10
10
|
#-----------
|
@@ -14,12 +14,28 @@ module ChargeBee
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.list(params={}, env=nil, headers={})
|
17
|
-
Request.
|
17
|
+
Request.send_list_request('get', uri_path("coupons"), params, env, headers)
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.retrieve(id, env=nil, headers={})
|
21
21
|
Request.send('get', uri_path("coupons",id.to_s), {}, env, headers)
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.update(id, params={}, env=nil, headers={})
|
25
|
+
Request.send('post', uri_path("coupons",id.to_s), params, env, headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.delete(id, env=nil, headers={})
|
29
|
+
Request.send('post', uri_path("coupons",id.to_s,"delete"), {}, env, headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.copy(params, env=nil, headers={})
|
33
|
+
Request.send('post', uri_path("coupons","copy"), params, env, headers)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.unarchive(id, env=nil, headers={})
|
37
|
+
Request.send('post', uri_path("coupons",id.to_s,"unarchive"), {}, env, headers)
|
38
|
+
end
|
39
|
+
|
24
40
|
end # ~Coupon
|
25
41
|
end # ~ChargeBee
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class CouponCode < Model
|
3
3
|
|
4
|
-
attr_accessor :code, :coupon_id, :coupon_set_name
|
4
|
+
attr_accessor :code, :status, :coupon_id, :coupon_set_id, :coupon_set_name
|
5
5
|
|
6
6
|
# OPERATIONS
|
7
7
|
#-----------
|
@@ -14,5 +14,13 @@ module ChargeBee
|
|
14
14
|
Request.send('get', uri_path("coupon_codes",id.to_s), {}, env, headers)
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.list(params={}, env=nil, headers={})
|
18
|
+
Request.send_list_request('get', uri_path("coupon_codes"), params, env, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.archive(id, env=nil, headers={})
|
22
|
+
Request.send('post', uri_path("coupon_codes",id.to_s,"archive"), {}, env, headers)
|
23
|
+
end
|
24
|
+
|
17
25
|
end # ~CouponCode
|
18
26
|
end # ~ChargeBee
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class CouponSet < Model
|
3
|
+
|
4
|
+
attr_accessor :id, :coupon_id, :name, :total_count, :redeemed_count, :archived_count, :meta_data
|
5
|
+
|
6
|
+
# OPERATIONS
|
7
|
+
#-----------
|
8
|
+
|
9
|
+
def self.create(params, env=nil, headers={})
|
10
|
+
Request.send('post', uri_path("coupon_sets"), params, env, headers)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.add_coupon_codes(id, params={}, env=nil, headers={})
|
14
|
+
Request.send('post', uri_path("coupon_sets",id.to_s,"add_coupon_codes"), params, env, headers)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list(params={}, env=nil, headers={})
|
18
|
+
Request.send_list_request('get', uri_path("coupon_sets"), params, env, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.retrieve(id, env=nil, headers={})
|
22
|
+
Request.send('get', uri_path("coupon_sets",id.to_s), {}, env, headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.update(id, params={}, env=nil, headers={})
|
26
|
+
Request.send('post', uri_path("coupon_sets",id.to_s,"update"), params, env, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.delete(id, env=nil, headers={})
|
30
|
+
Request.send('post', uri_path("coupon_sets",id.to_s,"delete"), {}, env, headers)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.delete_unused_coupon_codes(id, env=nil, headers={})
|
34
|
+
Request.send('post', uri_path("coupon_sets",id.to_s,"delete_unused_coupon_codes"), {}, env, headers)
|
35
|
+
end
|
36
|
+
|
37
|
+
end # ~CouponSet
|
38
|
+
end # ~ChargeBee
|