chargebee 1.3.9 → 1.4.0

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.
@@ -1,3 +1,11 @@
1
+ ### v1.4.0 (2014-05-23)
2
+ * * *
3
+ * New API to create customer without subscription. See https://apidocs.chargebee.com/docs/api/customers#create_a_customer
4
+
5
+ * New API to fetch invoices for a customer. This helps you fetch the invoices created due to multiple subscriptions present for any customer. See https://apidocs.chargebee.com/docs/api/invoices#list_invoices_for_a_customer
6
+
7
+ * Customer id reference is added to the invoice attributes.
8
+
1
9
  ### v1.3.9 (2014-04-22)
2
10
  * * *
3
11
  Support for returning shipping address as part of create/update subscription API.
@@ -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.3.9'
8
- s.date = '2014-04-22'
7
+ s.version = '1.4.0'
8
+ s.date = '2014-05-26'
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."
@@ -26,7 +26,7 @@ require File.dirname(__FILE__) + '/chargebee/models/download'
26
26
 
27
27
  module ChargeBee
28
28
 
29
- VERSION = '1.3.9'
29
+ VERSION = '1.4.0'
30
30
 
31
31
  @@default_env = nil
32
32
  @@verify_ca_certs = true
@@ -6,26 +6,26 @@ module ChargeBee
6
6
 
7
7
  # OPERATIONS
8
8
  #-----------
9
-
9
+
10
10
  def self.create(params, env=nil)
11
- Request.send('post', "/addons", params, env)
12
- end
11
+ Request.send('post', uri_path("addons"), params, env)
12
+ end
13
13
 
14
14
  def self.update(id, params={}, env=nil)
15
- Request.send('post', "/addons/#{id.to_s}", params, env)
16
- end
15
+ Request.send('post', uri_path("addons",id.to_s), params, env)
16
+ end
17
17
 
18
18
  def self.list(params={}, env=nil)
19
- Request.send('get', "/addons", params, env)
20
- end
19
+ Request.send('get', uri_path("addons"), params, env)
20
+ end
21
21
 
22
22
  def self.retrieve(id, env=nil)
23
- Request.send('get', "/addons/#{id.to_s}", {}, env)
24
- end
23
+ Request.send('get', uri_path("addons",id.to_s), {}, env)
24
+ end
25
25
 
26
26
  def self.delete(id, env=nil)
27
- Request.send('post', "/addons/#{id.to_s}/delete", {}, env)
28
- end
27
+ Request.send('post', uri_path("addons",id.to_s,"delete"), {}, env)
28
+ end
29
29
 
30
30
  end # ~Addon
31
- end # ~ChargeBee
31
+ end # ~ChargeBee
@@ -6,14 +6,14 @@ module ChargeBee
6
6
 
7
7
  # OPERATIONS
8
8
  #-----------
9
-
9
+
10
10
  def self.retrieve(params, env=nil)
11
- Request.send('get', "/addresses", params, env)
12
- end
11
+ Request.send('get', uri_path("addresses"), params, env)
12
+ end
13
13
 
14
14
  def self.update(params, env=nil)
15
- Request.send('post', "/addresses", params, env)
16
- end
15
+ Request.send('post', uri_path("addresses"), params, env)
16
+ end
17
17
 
18
18
  end # ~Address
19
- end # ~ChargeBee
19
+ end # ~ChargeBee
@@ -7,18 +7,18 @@ module ChargeBee
7
7
 
8
8
  # OPERATIONS
9
9
  #-----------
10
-
10
+
11
11
  def self.retrieve(id, env=nil)
12
- Request.send('get', "/cards/#{id.to_s}", {}, env)
13
- end
12
+ Request.send('get', uri_path("cards",id.to_s), {}, env)
13
+ end
14
14
 
15
15
  def self.update_card_for_customer(id, params, env=nil)
16
- Request.send('post', "/customers/#{id.to_s}/credit_card", params, env)
17
- end
16
+ Request.send('post', uri_path("customers",id.to_s,"credit_card"), params, env)
17
+ end
18
18
 
19
19
  def self.delete_card_for_customer(id, env=nil)
20
- Request.send('post', "/customers/#{id.to_s}/delete_card", {}, env)
21
- end
20
+ Request.send('post', uri_path("customers",id.to_s,"delete_card"), {}, env)
21
+ end
22
22
 
23
23
  end # ~Card
24
- end # ~ChargeBee
24
+ end # ~ChargeBee
@@ -5,22 +5,22 @@ module ChargeBee
5
5
 
6
6
  # OPERATIONS
7
7
  #-----------
8
-
8
+
9
9
  def self.create(params, env=nil)
10
- Request.send('post', "/comments", params, env)
11
- end
10
+ Request.send('post', uri_path("comments"), params, env)
11
+ end
12
12
 
13
13
  def self.retrieve(id, env=nil)
14
- Request.send('get', "/comments/#{id.to_s}", {}, env)
15
- end
14
+ Request.send('get', uri_path("comments",id.to_s), {}, env)
15
+ end
16
16
 
17
17
  def self.list(params={}, env=nil)
18
- Request.send('get', "/comments", params, env)
19
- end
18
+ Request.send('get', uri_path("comments"), params, env)
19
+ end
20
20
 
21
21
  def self.delete(id, env=nil)
22
- Request.send('post', "/comments/#{id.to_s}/delete", {}, env)
23
- end
22
+ Request.send('post', uri_path("comments",id.to_s,"delete"), {}, env)
23
+ end
24
24
 
25
25
  end # ~Comment
26
- end # ~ChargeBee
26
+ end # ~ChargeBee
@@ -8,18 +8,18 @@ module ChargeBee
8
8
 
9
9
  # OPERATIONS
10
10
  #-----------
11
-
11
+
12
12
  def self.create(params, env=nil)
13
- Request.send('post', "/coupons", params, env)
14
- end
13
+ Request.send('post', uri_path("coupons"), params, env)
14
+ end
15
15
 
16
16
  def self.list(params={}, env=nil)
17
- Request.send('get', "/coupons", params, env)
18
- end
17
+ Request.send('get', uri_path("coupons"), params, env)
18
+ end
19
19
 
20
20
  def self.retrieve(id, env=nil)
21
- Request.send('get', "/coupons/#{id.to_s}", {}, env)
22
- end
21
+ Request.send('get', uri_path("coupons",id.to_s), {}, env)
22
+ end
23
23
 
24
24
  end # ~Coupon
25
- end # ~ChargeBee
25
+ end # ~ChargeBee
@@ -5,14 +5,14 @@ module ChargeBee
5
5
 
6
6
  # OPERATIONS
7
7
  #-----------
8
-
8
+
9
9
  def self.create(params, env=nil)
10
- Request.send('post', "/coupon_codes", params, env)
11
- end
10
+ Request.send('post', uri_path("coupon_codes"), params, env)
11
+ end
12
12
 
13
13
  def self.retrieve(id, env=nil)
14
- Request.send('get', "/coupon_codes/#{id.to_s}", {}, env)
15
- end
14
+ Request.send('get', uri_path("coupon_codes",id.to_s), {}, env)
15
+ end
16
16
 
17
17
  end # ~CouponCode
18
- end # ~ChargeBee
18
+ end # ~ChargeBee
@@ -10,22 +10,26 @@ module ChargeBee
10
10
 
11
11
  # OPERATIONS
12
12
  #-----------
13
-
13
+
14
+ def self.create(params={}, env=nil)
15
+ Request.send('post', uri_path("customers"), params, env)
16
+ end
17
+
14
18
  def self.list(params={}, env=nil)
15
- Request.send('get', "/customers", params, env)
16
- end
19
+ Request.send('get', uri_path("customers"), params, env)
20
+ end
17
21
 
18
22
  def self.retrieve(id, env=nil)
19
- Request.send('get', "/customers/#{id.to_s}", {}, env)
20
- end
23
+ Request.send('get', uri_path("customers",id.to_s), {}, env)
24
+ end
21
25
 
22
26
  def self.update(id, params={}, env=nil)
23
- Request.send('post', "/customers/#{id.to_s}", params, env)
24
- end
27
+ Request.send('post', uri_path("customers",id.to_s), params, env)
28
+ end
25
29
 
26
30
  def self.update_billing_info(id, params={}, env=nil)
27
- Request.send('post', "/customers/#{id.to_s}/update_billing_info", params, env)
28
- end
31
+ Request.send('post', uri_path("customers",id.to_s,"update_billing_info"), params, env)
32
+ end
29
33
 
30
34
  end # ~Customer
31
- end # ~ChargeBee
35
+ end # ~ChargeBee
@@ -5,6 +5,6 @@ module ChargeBee
5
5
 
6
6
  # OPERATIONS
7
7
  #-----------
8
-
8
+
9
9
  end # ~Download
10
- end # ~ChargeBee
10
+ end # ~ChargeBee
@@ -18,14 +18,14 @@ module ChargeBee
18
18
 
19
19
  # OPERATIONS
20
20
  #-----------
21
-
21
+
22
22
  def self.create_subscription(params, env=nil)
23
- Request.send('post', "/estimates/create_subscription", params, env)
24
- end
23
+ Request.send('post', uri_path("estimates","create_subscription"), params, env)
24
+ end
25
25
 
26
26
  def self.update_subscription(params, env=nil)
27
- Request.send('post', "/estimates/update_subscription", params, env)
28
- end
27
+ Request.send('post', uri_path("estimates","update_subscription"), params, env)
28
+ end
29
29
 
30
30
  end # ~Estimate
31
- end # ~ChargeBee
31
+ end # ~ChargeBee
@@ -22,14 +22,14 @@ module ChargeBee
22
22
 
23
23
  # OPERATIONS
24
24
  #-----------
25
-
25
+
26
26
  def self.list(params={}, env=nil)
27
- Request.send('get', "/events", params, env)
28
- end
27
+ Request.send('get', uri_path("events"), params, env)
28
+ end
29
29
 
30
30
  def self.retrieve(id, env=nil)
31
- Request.send('get', "/events/#{id.to_s}", {}, env)
32
- end
31
+ Request.send('get', uri_path("events",id.to_s), {}, env)
32
+ end
33
33
 
34
34
  end # ~Event
35
- end # ~ChargeBee
35
+ end # ~ChargeBee
@@ -17,30 +17,30 @@ module ChargeBee
17
17
 
18
18
  # OPERATIONS
19
19
  #-----------
20
-
20
+
21
21
  def self.checkout_new(params, env=nil)
22
- Request.send('post', "/hosted_pages/checkout_new", params, env)
23
- end
22
+ Request.send('post', uri_path("hosted_pages","checkout_new"), params, env)
23
+ end
24
24
 
25
25
  def self.checkout_existing(params, env=nil)
26
- Request.send('post', "/hosted_pages/checkout_existing", params, env)
27
- end
26
+ Request.send('post', uri_path("hosted_pages","checkout_existing"), params, env)
27
+ end
28
28
 
29
29
  def self.update_card(params, env=nil)
30
- Request.send('post', "/hosted_pages/update_card", params, env)
31
- end
30
+ Request.send('post', uri_path("hosted_pages","update_card"), params, env)
31
+ end
32
32
 
33
33
  def self.checkout_onetime_charge(params, env=nil)
34
- Request.send('post', "/hosted_pages/checkout_onetime_charge", params, env)
35
- end
34
+ Request.send('post', uri_path("hosted_pages","checkout_onetime_charge"), params, env)
35
+ end
36
36
 
37
37
  def self.checkout_onetime_addons(params, env=nil)
38
- Request.send('post', "/hosted_pages/checkout_onetime_addons", params, env)
39
- end
38
+ Request.send('post', uri_path("hosted_pages","checkout_onetime_addons"), params, env)
39
+ end
40
40
 
41
41
  def self.retrieve(id, env=nil)
42
- Request.send('get', "/hosted_pages/#{id.to_s}", {}, env)
43
- end
42
+ Request.send('get', uri_path("hosted_pages",id.to_s), {}, env)
43
+ end
44
44
 
45
45
  end # ~HostedPage
46
- end # ~ChargeBee
46
+ end # ~ChargeBee
@@ -17,51 +17,56 @@ module ChargeBee
17
17
  attr_accessor :txn_id, :applied_amount, :txn_type, :txn_status, :txn_date, :txn_amount
18
18
  end
19
19
 
20
- attr_accessor :id, :subscription_id, :recurring, :status, :vat_number, :start_date, :end_date,
21
- :amount, :paid_on, :next_retry, :sub_total, :tax, :line_items, :discounts, :taxes, :linked_transactions
20
+ attr_accessor :id, :customer_id, :subscription_id, :recurring, :status, :vat_number, :start_date,
21
+ :end_date, :amount, :paid_on, :next_retry, :sub_total, :tax, :line_items, :discounts, :taxes,
22
+ :linked_transactions
22
23
 
23
24
  # OPERATIONS
24
25
  #-----------
25
-
26
+
26
27
  def self.charge(params, env=nil)
27
- Request.send('post', "/invoices/charge", params, env)
28
- end
28
+ Request.send('post', uri_path("invoices","charge"), params, env)
29
+ end
29
30
 
30
31
  def self.charge_addon(params, env=nil)
31
- Request.send('post', "/invoices/charge_addon", params, env)
32
- end
32
+ Request.send('post', uri_path("invoices","charge_addon"), params, env)
33
+ end
33
34
 
34
35
  def self.list(params={}, env=nil)
35
- Request.send('get', "/invoices", params, env)
36
- end
36
+ Request.send('get', uri_path("invoices"), params, env)
37
+ end
37
38
 
38
39
  def self.invoices_for_subscription(id, params={}, env=nil)
39
- Request.send('get', "/subscriptions/#{id.to_s}/invoices", params, env)
40
- end
40
+ Request.send('get', uri_path("subscriptions",id.to_s,"invoices"), params, env)
41
+ end
42
+
43
+ def self.invoices_for_customer(id, params={}, env=nil)
44
+ Request.send('get', uri_path("customers",id.to_s,"invoices"), params, env)
45
+ end
41
46
 
42
47
  def self.retrieve(id, env=nil)
43
- Request.send('get', "/invoices/#{id.to_s}", {}, env)
44
- end
48
+ Request.send('get', uri_path("invoices",id.to_s), {}, env)
49
+ end
45
50
 
46
51
  def self.pdf(id, env=nil)
47
- Request.send('post', "/invoices/#{id.to_s}/pdf", {}, env)
48
- end
52
+ Request.send('post', uri_path("invoices",id.to_s,"pdf"), {}, env)
53
+ end
49
54
 
50
55
  def self.add_charge(id, params, env=nil)
51
- Request.send('post', "/invoices/#{id.to_s}/add_charge", params, env)
52
- end
56
+ Request.send('post', uri_path("invoices",id.to_s,"add_charge"), params, env)
57
+ end
53
58
 
54
59
  def self.add_addon_charge(id, params, env=nil)
55
- Request.send('post', "/invoices/#{id.to_s}/add_addon_charge", params, env)
56
- end
60
+ Request.send('post', uri_path("invoices",id.to_s,"add_addon_charge"), params, env)
61
+ end
57
62
 
58
63
  def self.collect(id, env=nil)
59
- Request.send('post', "/invoices/#{id.to_s}/collect", {}, env)
60
- end
64
+ Request.send('post', uri_path("invoices",id.to_s,"collect"), {}, env)
65
+ end
61
66
 
62
67
  def self.refund(id, params={}, env=nil)
63
- Request.send('post', "/invoices/#{id.to_s}/refund", params, env)
64
- end
68
+ Request.send('post', uri_path("invoices",id.to_s,"refund"), params, env)
69
+ end
65
70
 
66
71
  end # ~Invoice
67
- end # ~ChargeBee
72
+ end # ~ChargeBee
@@ -1,3 +1,5 @@
1
+ require 'uri'
2
+
1
3
  module ChargeBee
2
4
  class Model
3
5
 
@@ -34,7 +36,7 @@ module ChargeBee
34
36
  end
35
37
  end
36
38
  end
37
-
39
+
38
40
  def method_missing(m, *args, &block)
39
41
  if(@values.has_key?(m))
40
42
  return @values[m]
@@ -43,6 +45,10 @@ module ChargeBee
43
45
  puts @values
44
46
  end
45
47
 
48
+ def self.uri_path(*paths)
49
+ "/#{paths.map{|path| "#{URI.encode(path)}"}.join('/')}"
50
+ end
51
+
46
52
  def self.construct(values, sub_types = {})
47
53
  if(values != nil)
48
54
  obj = self.new(values, sub_types)
@@ -6,26 +6,26 @@ module ChargeBee
6
6
 
7
7
  # OPERATIONS
8
8
  #-----------
9
-
9
+
10
10
  def self.create(params, env=nil)
11
- Request.send('post', "/plans", params, env)
12
- end
11
+ Request.send('post', uri_path("plans"), params, env)
12
+ end
13
13
 
14
14
  def self.update(id, params={}, env=nil)
15
- Request.send('post', "/plans/#{id.to_s}", params, env)
16
- end
15
+ Request.send('post', uri_path("plans",id.to_s), params, env)
16
+ end
17
17
 
18
18
  def self.list(params={}, env=nil)
19
- Request.send('get', "/plans", params, env)
20
- end
19
+ Request.send('get', uri_path("plans"), params, env)
20
+ end
21
21
 
22
22
  def self.retrieve(id, env=nil)
23
- Request.send('get', "/plans/#{id.to_s}", {}, env)
24
- end
23
+ Request.send('get', uri_path("plans",id.to_s), {}, env)
24
+ end
25
25
 
26
26
  def self.delete(id, env=nil)
27
- Request.send('post', "/plans/#{id.to_s}/delete", {}, env)
28
- end
27
+ Request.send('post', uri_path("plans",id.to_s,"delete"), {}, env)
28
+ end
29
29
 
30
30
  end # ~Plan
31
- end # ~ChargeBee
31
+ end # ~ChargeBee
@@ -20,46 +20,46 @@ module ChargeBee
20
20
 
21
21
  # OPERATIONS
22
22
  #-----------
23
-
23
+
24
24
  def self.create(params, env=nil)
25
- Request.send('post', "/subscriptions", params, env)
26
- end
25
+ Request.send('post', uri_path("subscriptions"), params, env)
26
+ end
27
27
 
28
28
  def self.create_for_customer(id, params, env=nil)
29
- Request.send('post', "/customers/#{id.to_s}/subscriptions", params, env)
30
- end
29
+ Request.send('post', uri_path("customers",id.to_s,"subscriptions"), params, env)
30
+ end
31
31
 
32
32
  def self.list(params={}, env=nil)
33
- Request.send('get', "/subscriptions", params, env)
34
- end
33
+ Request.send('get', uri_path("subscriptions"), params, env)
34
+ end
35
35
 
36
36
  def self.subscriptions_for_customer(id, params={}, env=nil)
37
- Request.send('get', "/customers/#{id.to_s}/subscriptions", params, env)
38
- end
37
+ Request.send('get', uri_path("customers",id.to_s,"subscriptions"), params, env)
38
+ end
39
39
 
40
40
  def self.retrieve(id, env=nil)
41
- Request.send('get', "/subscriptions/#{id.to_s}", {}, env)
42
- end
41
+ Request.send('get', uri_path("subscriptions",id.to_s), {}, env)
42
+ end
43
43
 
44
44
  def self.update(id, params={}, env=nil)
45
- Request.send('post', "/subscriptions/#{id.to_s}", params, env)
46
- end
45
+ Request.send('post', uri_path("subscriptions",id.to_s), params, env)
46
+ end
47
47
 
48
48
  def self.change_term_end(id, params, env=nil)
49
- Request.send('post', "/subscriptions/#{id.to_s}/change_term_end", params, env)
50
- end
49
+ Request.send('post', uri_path("subscriptions",id.to_s,"change_term_end"), params, env)
50
+ end
51
51
 
52
52
  def self.cancel(id, params={}, env=nil)
53
- Request.send('post', "/subscriptions/#{id.to_s}/cancel", params, env)
54
- end
53
+ Request.send('post', uri_path("subscriptions",id.to_s,"cancel"), params, env)
54
+ end
55
55
 
56
56
  def self.reactivate(id, params={}, env=nil)
57
- Request.send('post', "/subscriptions/#{id.to_s}/reactivate", params, env)
58
- end
57
+ Request.send('post', uri_path("subscriptions",id.to_s,"reactivate"), params, env)
58
+ end
59
59
 
60
60
  def self.add_credit(id, params, env=nil)
61
- Request.send('post', "/subscriptions/#{id.to_s}/add_credit", params, env)
62
- end
61
+ Request.send('post', uri_path("subscriptions",id.to_s,"add_credit"), params, env)
62
+ end
63
63
 
64
64
  end # ~Subscription
65
- end # ~ChargeBee
65
+ end # ~ChargeBee
@@ -11,30 +11,30 @@ module ChargeBee
11
11
 
12
12
  # OPERATIONS
13
13
  #-----------
14
-
14
+
15
15
  def self.list(params={}, env=nil)
16
- Request.send('get', "/transactions", params, env)
17
- end
16
+ Request.send('get', uri_path("transactions"), params, env)
17
+ end
18
18
 
19
19
  def self.transactions_for_subscription(id, params={}, env=nil)
20
- Request.send('get', "/subscriptions/#{id.to_s}/transactions", params, env)
21
- end
20
+ Request.send('get', uri_path("subscriptions",id.to_s,"transactions"), params, env)
21
+ end
22
22
 
23
23
  def self.transactions_for_invoice(id, params={}, env=nil)
24
- Request.send('get', "/invoices/#{id.to_s}/transactions", params, env)
25
- end
24
+ Request.send('get', uri_path("invoices",id.to_s,"transactions"), params, env)
25
+ end
26
26
 
27
27
  def self.retrieve(id, env=nil)
28
- Request.send('get', "/transactions/#{id.to_s}", {}, env)
29
- end
28
+ Request.send('get', uri_path("transactions",id.to_s), {}, env)
29
+ end
30
30
 
31
31
  def self.record_payment(id, params, env=nil)
32
- Request.send('post', "/invoices/#{id.to_s}/record_payment", params, env)
33
- end
32
+ Request.send('post', uri_path("invoices",id.to_s,"record_payment"), params, env)
33
+ end
34
34
 
35
35
  def self.refund(id, params={}, env=nil)
36
- Request.send('post', "/transactions/#{id.to_s}/refund", params, env)
37
- end
36
+ Request.send('post', uri_path("transactions",id.to_s,"refund"), params, env)
37
+ end
38
38
 
39
39
  end # ~Transaction
40
- end # ~ChargeBee
40
+ end # ~ChargeBee
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: chargebee
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.9
5
+ version: 1.4.0
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: 2014-04-22 00:00:00 Z
14
+ date: 2014-05-26 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json_pure