chargebee 2.6.4 → 2.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1524 -1488
  3. data/LICENSE +24 -24
  4. data/README.rdoc +41 -41
  5. data/chargebee.gemspec +4 -3
  6. data/lib/chargebee.rb +85 -85
  7. data/lib/chargebee/environment.rb +28 -28
  8. data/lib/chargebee/errors.rb +43 -43
  9. data/lib/chargebee/models/addon.rb +45 -45
  10. data/lib/chargebee/models/address.rb +18 -18
  11. data/lib/chargebee/models/card.rb +32 -32
  12. data/lib/chargebee/models/comment.rb +25 -25
  13. data/lib/chargebee/models/contact.rb +10 -10
  14. data/lib/chargebee/models/coupon.rb +40 -40
  15. data/lib/chargebee/models/coupon_code.rb +25 -25
  16. data/lib/chargebee/models/coupon_set.rb +37 -37
  17. data/lib/chargebee/models/credit_note.rb +77 -77
  18. data/lib/chargebee/models/credit_note_estimate.rb +35 -35
  19. data/lib/chargebee/models/customer.rb +137 -120
  20. data/lib/chargebee/models/download.rb +9 -9
  21. data/lib/chargebee/models/estimate.rb +46 -46
  22. data/lib/chargebee/models/event.rb +45 -45
  23. data/lib/chargebee/models/export.rb +86 -86
  24. data/lib/chargebee/models/gift.rb +42 -42
  25. data/lib/chargebee/models/hierarchy.rb +10 -0
  26. data/lib/chargebee/models/hosted_page.rb +77 -77
  27. data/lib/chargebee/models/invoice.rb +172 -172
  28. data/lib/chargebee/models/invoice_estimate.rb +35 -35
  29. data/lib/chargebee/models/model.rb +101 -101
  30. data/lib/chargebee/models/order.rb +76 -76
  31. data/lib/chargebee/models/payment_source.rb +79 -71
  32. data/lib/chargebee/models/plan.rb +60 -59
  33. data/lib/chargebee/models/portal_session.rb +30 -30
  34. data/lib/chargebee/models/promotional_credit.rb +30 -30
  35. data/lib/chargebee/models/quote.rb +72 -72
  36. data/lib/chargebee/models/resource_migration.rb +13 -13
  37. data/lib/chargebee/models/site_migration_detail.rb +14 -14
  38. data/lib/chargebee/models/subscription.rb +137 -137
  39. data/lib/chargebee/models/subscription_estimate.rb +13 -13
  40. data/lib/chargebee/models/third_party_payment_method.rb +9 -9
  41. data/lib/chargebee/models/time_machine.rb +46 -46
  42. data/lib/chargebee/models/token.rb +11 -0
  43. data/lib/chargebee/models/transaction.rb +62 -62
  44. data/lib/chargebee/models/unbilled_charge.rb +31 -31
  45. data/lib/chargebee/models/virtual_bank_account.rb +30 -26
  46. data/lib/chargebee/request.rb +27 -27
  47. data/lib/chargebee/rest.rb +92 -92
  48. data/lib/chargebee/result.rb +255 -240
  49. data/spec/errors_spec.rb +23 -23
  50. data/spec/sample_response.rb +73 -73
  51. metadata +5 -4
  52. data/lib/chargebee/.DS_Store +0 -0
@@ -1,60 +1,61 @@
1
- module ChargeBee
2
- class Plan < Model
3
-
4
- class Tier < Model
5
- attr_accessor :starting_unit, :ending_unit, :price
6
- end
7
-
8
- class ApplicableAddon < Model
9
- attr_accessor :id
10
- end
11
-
12
- class AttachedAddon < Model
13
- attr_accessor :id, :quantity, :billing_cycles, :type
14
- end
15
-
16
- class EventBasedAddon < Model
17
- attr_accessor :id, :quantity, :on_event, :charge_once
18
- end
19
-
20
- attr_accessor :id, :name, :invoice_name, :description, :price, :currency_code, :period, :period_unit,
21
- :trial_period, :trial_period_unit, :pricing_model, :charge_model, :free_quantity, :setup_cost,
22
- :downgrade_penalty, :status, :archived_at, :billing_cycles, :redirect_url, :enabled_in_hosted_pages,
23
- :enabled_in_portal, :addon_applicability, :tax_code, :sku, :accounting_code, :accounting_category1,
24
- :accounting_category2, :is_shippable, :shipping_frequency_period, :shipping_frequency_period_unit,
25
- :resource_version, :updated_at, :giftable, :claim_url, :invoice_notes, :taxable, :tax_profile_id,
26
- :meta_data, :tiers, :applicable_addons, :attached_addons, :event_based_addons
27
-
28
- # OPERATIONS
29
- #-----------
30
-
31
- def self.create(params, env=nil, headers={})
32
- Request.send('post', uri_path("plans"), params, env, headers)
33
- end
34
-
35
- def self.update(id, params={}, env=nil, headers={})
36
- Request.send('post', uri_path("plans",id.to_s), params, env, headers)
37
- end
38
-
39
- def self.list(params={}, env=nil, headers={})
40
- Request.send_list_request('get', uri_path("plans"), params, env, headers)
41
- end
42
-
43
- def self.retrieve(id, env=nil, headers={})
44
- Request.send('get', uri_path("plans",id.to_s), {}, env, headers)
45
- end
46
-
47
- def self.delete(id, env=nil, headers={})
48
- Request.send('post', uri_path("plans",id.to_s,"delete"), {}, env, headers)
49
- end
50
-
51
- def self.copy(params, env=nil, headers={})
52
- Request.send('post', uri_path("plans","copy"), params, env, headers)
53
- end
54
-
55
- def self.unarchive(id, env=nil, headers={})
56
- Request.send('post', uri_path("plans",id.to_s,"unarchive"), {}, env, headers)
57
- end
58
-
59
- end # ~Plan
1
+ module ChargeBee
2
+ class Plan < Model
3
+
4
+ class Tier < Model
5
+ attr_accessor :starting_unit, :ending_unit, :price
6
+ end
7
+
8
+ class ApplicableAddon < Model
9
+ attr_accessor :id
10
+ end
11
+
12
+ class AttachedAddon < Model
13
+ attr_accessor :id, :quantity, :billing_cycles, :type
14
+ end
15
+
16
+ class EventBasedAddon < Model
17
+ attr_accessor :id, :quantity, :on_event, :charge_once
18
+ end
19
+
20
+ attr_accessor :id, :name, :invoice_name, :description, :price, :currency_code, :period, :period_unit,
21
+ :trial_period, :trial_period_unit, :pricing_model, :charge_model, :free_quantity, :setup_cost,
22
+ :downgrade_penalty, :status, :archived_at, :billing_cycles, :redirect_url, :enabled_in_hosted_pages,
23
+ :enabled_in_portal, :addon_applicability, :tax_code, :avalara_sale_type, :avalara_transaction_type,
24
+ :avalara_service_type, :sku, :accounting_code, :accounting_category1, :accounting_category2,
25
+ :is_shippable, :shipping_frequency_period, :shipping_frequency_period_unit, :resource_version,
26
+ :updated_at, :giftable, :claim_url, :invoice_notes, :taxable, :tax_profile_id, :meta_data, :tiers,
27
+ :applicable_addons, :attached_addons, :event_based_addons
28
+
29
+ # OPERATIONS
30
+ #-----------
31
+
32
+ def self.create(params, env=nil, headers={})
33
+ Request.send('post', uri_path("plans"), params, env, headers)
34
+ end
35
+
36
+ def self.update(id, params={}, env=nil, headers={})
37
+ Request.send('post', uri_path("plans",id.to_s), params, env, headers)
38
+ end
39
+
40
+ def self.list(params={}, env=nil, headers={})
41
+ Request.send_list_request('get', uri_path("plans"), params, env, headers)
42
+ end
43
+
44
+ def self.retrieve(id, env=nil, headers={})
45
+ Request.send('get', uri_path("plans",id.to_s), {}, env, headers)
46
+ end
47
+
48
+ def self.delete(id, env=nil, headers={})
49
+ Request.send('post', uri_path("plans",id.to_s,"delete"), {}, env, headers)
50
+ end
51
+
52
+ def self.copy(params, env=nil, headers={})
53
+ Request.send('post', uri_path("plans","copy"), params, env, headers)
54
+ end
55
+
56
+ def self.unarchive(id, env=nil, headers={})
57
+ Request.send('post', uri_path("plans",id.to_s,"unarchive"), {}, env, headers)
58
+ end
59
+
60
+ end # ~Plan
60
61
  end # ~ChargeBee
@@ -1,31 +1,31 @@
1
- module ChargeBee
2
- class PortalSession < Model
3
-
4
- class LinkedCustomer < Model
5
- attr_accessor :customer_id, :email, :has_billing_address, :has_payment_method, :has_active_subscription
6
- end
7
-
8
- attr_accessor :id, :token, :access_url, :redirect_url, :status, :created_at, :expires_at, :customer_id,
9
- :login_at, :logout_at, :login_ipaddress, :logout_ipaddress, :linked_customers
10
-
11
- # OPERATIONS
12
- #-----------
13
-
14
- def self.create(params, env=nil, headers={})
15
- Request.send('post', uri_path("portal_sessions"), params, env, headers)
16
- end
17
-
18
- def self.retrieve(id, env=nil, headers={})
19
- Request.send('get', uri_path("portal_sessions",id.to_s), {}, env, headers)
20
- end
21
-
22
- def self.logout(id, env=nil, headers={})
23
- Request.send('post', uri_path("portal_sessions",id.to_s,"logout"), {}, env, headers)
24
- end
25
-
26
- def self.activate(id, params, env=nil, headers={})
27
- Request.send('post', uri_path("portal_sessions",id.to_s,"activate"), params, env, headers)
28
- end
29
-
30
- end # ~PortalSession
1
+ module ChargeBee
2
+ class PortalSession < Model
3
+
4
+ class LinkedCustomer < Model
5
+ attr_accessor :customer_id, :email, :has_billing_address, :has_payment_method, :has_active_subscription
6
+ end
7
+
8
+ attr_accessor :id, :token, :access_url, :redirect_url, :status, :created_at, :expires_at, :customer_id,
9
+ :login_at, :logout_at, :login_ipaddress, :logout_ipaddress, :linked_customers
10
+
11
+ # OPERATIONS
12
+ #-----------
13
+
14
+ def self.create(params, env=nil, headers={})
15
+ Request.send('post', uri_path("portal_sessions"), params, env, headers)
16
+ end
17
+
18
+ def self.retrieve(id, env=nil, headers={})
19
+ Request.send('get', uri_path("portal_sessions",id.to_s), {}, env, headers)
20
+ end
21
+
22
+ def self.logout(id, env=nil, headers={})
23
+ Request.send('post', uri_path("portal_sessions",id.to_s,"logout"), {}, env, headers)
24
+ end
25
+
26
+ def self.activate(id, params, env=nil, headers={})
27
+ Request.send('post', uri_path("portal_sessions",id.to_s,"activate"), params, env, headers)
28
+ end
29
+
30
+ end # ~PortalSession
31
31
  end # ~ChargeBee
@@ -1,31 +1,31 @@
1
- module ChargeBee
2
- class PromotionalCredit < Model
3
-
4
- attr_accessor :id, :customer_id, :type, :amount, :currency_code, :description, :credit_type,
5
- :reference, :closing_balance, :done_by, :created_at
6
-
7
- # OPERATIONS
8
- #-----------
9
-
10
- def self.add(params, env=nil, headers={})
11
- Request.send('post', uri_path("promotional_credits","add"), params, env, headers)
12
- end
13
-
14
- def self.deduct(params, env=nil, headers={})
15
- Request.send('post', uri_path("promotional_credits","deduct"), params, env, headers)
16
- end
17
-
18
- def self.set(params, env=nil, headers={})
19
- Request.send('post', uri_path("promotional_credits","set"), params, env, headers)
20
- end
21
-
22
- def self.list(params={}, env=nil, headers={})
23
- Request.send_list_request('get', uri_path("promotional_credits"), params, env, headers)
24
- end
25
-
26
- def self.retrieve(id, env=nil, headers={})
27
- Request.send('get', uri_path("promotional_credits",id.to_s), {}, env, headers)
28
- end
29
-
30
- end # ~PromotionalCredit
1
+ module ChargeBee
2
+ class PromotionalCredit < Model
3
+
4
+ attr_accessor :id, :customer_id, :type, :amount, :currency_code, :description, :credit_type,
5
+ :reference, :closing_balance, :done_by, :created_at
6
+
7
+ # OPERATIONS
8
+ #-----------
9
+
10
+ def self.add(params, env=nil, headers={})
11
+ Request.send('post', uri_path("promotional_credits","add"), params, env, headers)
12
+ end
13
+
14
+ def self.deduct(params, env=nil, headers={})
15
+ Request.send('post', uri_path("promotional_credits","deduct"), params, env, headers)
16
+ end
17
+
18
+ def self.set(params, env=nil, headers={})
19
+ Request.send('post', uri_path("promotional_credits","set"), params, env, headers)
20
+ end
21
+
22
+ def self.list(params={}, env=nil, headers={})
23
+ Request.send_list_request('get', uri_path("promotional_credits"), params, env, headers)
24
+ end
25
+
26
+ def self.retrieve(id, env=nil, headers={})
27
+ Request.send('get', uri_path("promotional_credits",id.to_s), {}, env, headers)
28
+ end
29
+
30
+ end # ~PromotionalCredit
31
31
  end # ~ChargeBee
@@ -1,73 +1,73 @@
1
- module ChargeBee
2
- class Quote < Model
3
-
4
- class LineItem < Model
5
- attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_type, :tax_exempt_reason, :entity_id
6
- end
7
-
8
- class Discount < Model
9
- attr_accessor :amount, :description, :entity_type, :entity_id
10
- end
11
-
12
- class LineItemDiscount < Model
13
- attr_accessor :line_item_id, :discount_type, :coupon_id, :discount_amount
14
- end
15
-
16
- class Tax < Model
17
- attr_accessor :name, :amount, :description
18
- end
19
-
20
- class LineItemTax < Model
21
- attr_accessor :line_item_id, :tax_name, :tax_rate, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code
22
- end
23
-
24
- class ShippingAddress < Model
25
- attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
26
- end
27
-
28
- class BillingAddress < Model
29
- attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
30
- end
31
-
32
- attr_accessor :id, :po_number, :customer_id, :subscription_id, :status, :operation_type, :vat_number,
33
- :price_type, :valid_till, :date, :sub_total, :total, :credits_applied, :amount_paid, :amount_due,
34
- :resource_version, :updated_at, :currency_code, :line_items, :discounts, :line_item_discounts,
35
- :taxes, :line_item_taxes, :shipping_address, :billing_address
36
-
37
- # OPERATIONS
38
- #-----------
39
-
40
- def self.retrieve(id, env=nil, headers={})
41
- Request.send('get', uri_path("quotes",id.to_s), {}, env, headers)
42
- end
43
-
44
- def self.create_sub_for_customer_quote(id, params, env=nil, headers={})
45
- Request.send('post', uri_path("customers",id.to_s,"create_subscription_quote"), params, env, headers)
46
- end
47
-
48
- def self.update_subscription_quote(params, env=nil, headers={})
49
- Request.send('post', uri_path("quotes","update_subscription_quote"), params, env, headers)
50
- end
51
-
52
- def self.create_for_onetime_charges(params, env=nil, headers={})
53
- Request.send('post', uri_path("quotes","create_for_onetime_charges"), params, env, headers)
54
- end
55
-
56
- def self.convert(id, env=nil, headers={})
57
- Request.send('post', uri_path("quotes",id.to_s,"convert"), {}, env, headers)
58
- end
59
-
60
- def self.update_status(id, params, env=nil, headers={})
61
- Request.send('post', uri_path("quotes",id.to_s,"update_status"), params, env, headers)
62
- end
63
-
64
- def self.delete(id, params={}, env=nil, headers={})
65
- Request.send('post', uri_path("quotes",id.to_s,"delete"), params, env, headers)
66
- end
67
-
68
- def self.pdf(id, params={}, env=nil, headers={})
69
- Request.send('post', uri_path("quotes",id.to_s,"pdf"), params, env, headers)
70
- end
71
-
72
- end # ~Quote
1
+ module ChargeBee
2
+ class Quote < Model
3
+
4
+ class LineItem < Model
5
+ attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
6
+ end
7
+
8
+ class Discount < Model
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class LineItemDiscount < Model
13
+ attr_accessor :line_item_id, :discount_type, :coupon_id, :discount_amount
14
+ end
15
+
16
+ class Tax < Model
17
+ attr_accessor :name, :amount, :description
18
+ end
19
+
20
+ class LineItemTax < Model
21
+ attr_accessor :line_item_id, :tax_name, :tax_rate, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code
22
+ end
23
+
24
+ class ShippingAddress < Model
25
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
26
+ end
27
+
28
+ class BillingAddress < Model
29
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
30
+ end
31
+
32
+ attr_accessor :id, :po_number, :customer_id, :subscription_id, :status, :operation_type, :vat_number,
33
+ :price_type, :valid_till, :date, :sub_total, :total, :credits_applied, :amount_paid, :amount_due,
34
+ :resource_version, :updated_at, :currency_code, :line_items, :discounts, :line_item_discounts,
35
+ :taxes, :line_item_taxes, :shipping_address, :billing_address
36
+
37
+ # OPERATIONS
38
+ #-----------
39
+
40
+ def self.retrieve(id, env=nil, headers={})
41
+ Request.send('get', uri_path("quotes",id.to_s), {}, env, headers)
42
+ end
43
+
44
+ def self.create_sub_for_customer_quote(id, params, env=nil, headers={})
45
+ Request.send('post', uri_path("customers",id.to_s,"create_subscription_quote"), params, env, headers)
46
+ end
47
+
48
+ def self.update_subscription_quote(params, env=nil, headers={})
49
+ Request.send('post', uri_path("quotes","update_subscription_quote"), params, env, headers)
50
+ end
51
+
52
+ def self.create_for_onetime_charges(params, env=nil, headers={})
53
+ Request.send('post', uri_path("quotes","create_for_onetime_charges"), params, env, headers)
54
+ end
55
+
56
+ def self.convert(id, env=nil, headers={})
57
+ Request.send('post', uri_path("quotes",id.to_s,"convert"), {}, env, headers)
58
+ end
59
+
60
+ def self.update_status(id, params, env=nil, headers={})
61
+ Request.send('post', uri_path("quotes",id.to_s,"update_status"), params, env, headers)
62
+ end
63
+
64
+ def self.delete(id, params={}, env=nil, headers={})
65
+ Request.send('post', uri_path("quotes",id.to_s,"delete"), params, env, headers)
66
+ end
67
+
68
+ def self.pdf(id, params={}, env=nil, headers={})
69
+ Request.send('post', uri_path("quotes",id.to_s,"pdf"), params, env, headers)
70
+ end
71
+
72
+ end # ~Quote
73
73
  end # ~ChargeBee
@@ -1,14 +1,14 @@
1
- module ChargeBee
2
- class ResourceMigration < Model
3
-
4
- attr_accessor :from_site, :entity_type, :entity_id, :status, :errors, :created_at, :updated_at
5
-
6
- # OPERATIONS
7
- #-----------
8
-
9
- def self.retrieve_latest(params, env=nil, headers={})
10
- Request.send('get', uri_path("resource_migrations","retrieve_latest"), params, env, headers)
11
- end
12
-
13
- end # ~ResourceMigration
1
+ module ChargeBee
2
+ class ResourceMigration < Model
3
+
4
+ attr_accessor :from_site, :entity_type, :entity_id, :status, :errors, :created_at, :updated_at
5
+
6
+ # OPERATIONS
7
+ #-----------
8
+
9
+ def self.retrieve_latest(params, env=nil, headers={})
10
+ Request.send('get', uri_path("resource_migrations","retrieve_latest"), params, env, headers)
11
+ end
12
+
13
+ end # ~ResourceMigration
14
14
  end # ~ChargeBee
@@ -1,15 +1,15 @@
1
- module ChargeBee
2
- class SiteMigrationDetail < Model
3
-
4
- attr_accessor :entity_id, :other_site_name, :entity_id_at_other_site, :migrated_at, :entity_type,
5
- :status
6
-
7
- # OPERATIONS
8
- #-----------
9
-
10
- def self.list(params={}, env=nil, headers={})
11
- Request.send_list_request('get', uri_path("site_migration_details"), params, env, headers)
12
- end
13
-
14
- end # ~SiteMigrationDetail
1
+ module ChargeBee
2
+ class SiteMigrationDetail < Model
3
+
4
+ attr_accessor :entity_id, :other_site_name, :entity_id_at_other_site, :migrated_at, :entity_type,
5
+ :status
6
+
7
+ # OPERATIONS
8
+ #-----------
9
+
10
+ def self.list(params={}, env=nil, headers={})
11
+ Request.send_list_request('get', uri_path("site_migration_details"), params, env, headers)
12
+ end
13
+
14
+ end # ~SiteMigrationDetail
15
15
  end # ~ChargeBee