chargebee 2.6.4 → 2.6.5
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 +1501 -1488
- data/LICENSE +24 -24
- data/README.rdoc +41 -41
- data/chargebee.gemspec +2 -3
- data/lib/chargebee/environment.rb +28 -28
- data/lib/chargebee/errors.rb +43 -43
- data/lib/chargebee/models/addon.rb +45 -45
- data/lib/chargebee/models/address.rb +18 -18
- data/lib/chargebee/models/card.rb +32 -32
- data/lib/chargebee/models/comment.rb +25 -25
- data/lib/chargebee/models/contact.rb +10 -10
- data/lib/chargebee/models/coupon.rb +40 -40
- data/lib/chargebee/models/coupon_code.rb +25 -25
- data/lib/chargebee/models/coupon_set.rb +37 -37
- data/lib/chargebee/models/credit_note.rb +77 -77
- data/lib/chargebee/models/credit_note_estimate.rb +35 -35
- data/lib/chargebee/models/customer.rb +120 -120
- data/lib/chargebee/models/download.rb +9 -9
- data/lib/chargebee/models/estimate.rb +46 -46
- data/lib/chargebee/models/event.rb +45 -45
- data/lib/chargebee/models/export.rb +86 -86
- data/lib/chargebee/models/gift.rb +42 -42
- data/lib/chargebee/models/hosted_page.rb +77 -77
- data/lib/chargebee/models/invoice.rb +172 -172
- data/lib/chargebee/models/invoice_estimate.rb +35 -35
- data/lib/chargebee/models/model.rb +101 -101
- data/lib/chargebee/models/order.rb +76 -76
- data/lib/chargebee/models/payment_source.rb +75 -71
- data/lib/chargebee/models/plan.rb +60 -59
- data/lib/chargebee/models/portal_session.rb +30 -30
- data/lib/chargebee/models/promotional_credit.rb +30 -30
- data/lib/chargebee/models/quote.rb +72 -72
- data/lib/chargebee/models/resource_migration.rb +13 -13
- data/lib/chargebee/models/site_migration_detail.rb +14 -14
- data/lib/chargebee/models/subscription.rb +137 -137
- data/lib/chargebee/models/subscription_estimate.rb +13 -13
- data/lib/chargebee/models/third_party_payment_method.rb +9 -9
- data/lib/chargebee/models/time_machine.rb +46 -46
- data/lib/chargebee/models/transaction.rb +62 -62
- data/lib/chargebee/models/unbilled_charge.rb +31 -31
- data/lib/chargebee/models/virtual_bank_account.rb +30 -26
- data/lib/chargebee/request.rb +27 -27
- data/lib/chargebee/rest.rb +92 -92
- data/lib/chargebee/result.rb +240 -240
- data/lib/chargebee.rb +85 -85
- data/spec/errors_spec.rb +23 -23
- data/spec/sample_response.rb +73 -73
- metadata +3 -4
- data/lib/chargebee/.DS_Store +0 -0
data/lib/chargebee/result.rb
CHANGED
@@ -1,240 +1,240 @@
|
|
1
|
-
module ChargeBee
|
2
|
-
class Result
|
3
|
-
|
4
|
-
def initialize(response)
|
5
|
-
@response = response
|
6
|
-
end
|
7
|
-
|
8
|
-
def subscription()
|
9
|
-
subscription = get(:subscription, Subscription,
|
10
|
-
{:addons => Subscription::Addon, :event_based_addons => Subscription::EventBasedAddon, :charged_event_based_addons => Subscription::ChargedEventBasedAddon, :coupons => Subscription::Coupon, :shipping_address => Subscription::ShippingAddress, :referral_info => Subscription::ReferralInfo});
|
11
|
-
return subscription;
|
12
|
-
end
|
13
|
-
|
14
|
-
def customer()
|
15
|
-
customer = get(:customer, Customer,
|
16
|
-
{:billing_address => Customer::BillingAddress, :referral_urls => Customer::ReferralUrl, :contacts => Customer::Contact, :payment_method => Customer::PaymentMethod, :balances => Customer::Balance});
|
17
|
-
return customer;
|
18
|
-
end
|
19
|
-
|
20
|
-
def contact()
|
21
|
-
contact = get(:contact, Contact);
|
22
|
-
return contact;
|
23
|
-
end
|
24
|
-
|
25
|
-
def payment_source()
|
26
|
-
payment_source = get(:payment_source, PaymentSource,
|
27
|
-
{:card => PaymentSource::Card, :bank_account => PaymentSource::BankAccount, :amazon_payment => PaymentSource::AmazonPayment, :paypal => PaymentSource::Paypal});
|
28
|
-
return payment_source;
|
29
|
-
end
|
30
|
-
|
31
|
-
def third_party_payment_method()
|
32
|
-
third_party_payment_method = get(:third_party_payment_method, ThirdPartyPaymentMethod);
|
33
|
-
return third_party_payment_method;
|
34
|
-
end
|
35
|
-
|
36
|
-
def virtual_bank_account()
|
37
|
-
virtual_bank_account = get(:virtual_bank_account, VirtualBankAccount);
|
38
|
-
return virtual_bank_account;
|
39
|
-
end
|
40
|
-
|
41
|
-
def card()
|
42
|
-
card = get(:card, Card);
|
43
|
-
return card;
|
44
|
-
end
|
45
|
-
|
46
|
-
def promotional_credit()
|
47
|
-
promotional_credit = get(:promotional_credit, PromotionalCredit);
|
48
|
-
return promotional_credit;
|
49
|
-
end
|
50
|
-
|
51
|
-
def invoice()
|
52
|
-
invoice = get(:invoice, Invoice,
|
53
|
-
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
54
|
-
return invoice;
|
55
|
-
end
|
56
|
-
|
57
|
-
def credit_note()
|
58
|
-
credit_note = get(:credit_note, CreditNote,
|
59
|
-
{:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :line_item_discounts => CreditNote::LineItemDiscount, :line_item_tiers => CreditNote::LineItemTier, :taxes => CreditNote::Tax, :line_item_taxes => CreditNote::LineItemTax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
|
60
|
-
return credit_note;
|
61
|
-
end
|
62
|
-
|
63
|
-
def unbilled_charge()
|
64
|
-
unbilled_charge = get(:unbilled_charge, UnbilledCharge,
|
65
|
-
{:tiers => UnbilledCharge::Tier});
|
66
|
-
return unbilled_charge;
|
67
|
-
end
|
68
|
-
|
69
|
-
def order()
|
70
|
-
order = get(:order, Order,
|
71
|
-
{:order_line_items => Order::OrderLineItem, :shipping_address => Order::ShippingAddress, :billing_address => Order::BillingAddress, :line_item_taxes => Order::LineItemTax, :line_item_discounts => Order::LineItemDiscount, :linked_credit_notes => Order::LinkedCreditNote});
|
72
|
-
return order;
|
73
|
-
end
|
74
|
-
|
75
|
-
def gift()
|
76
|
-
gift = get(:gift, Gift,
|
77
|
-
{:gifter => Gift::Gifter, :gift_receiver => Gift::GiftReceiver, :gift_timelines => Gift::GiftTimeline});
|
78
|
-
return gift;
|
79
|
-
end
|
80
|
-
|
81
|
-
def transaction()
|
82
|
-
transaction = get(:transaction, Transaction,
|
83
|
-
{:linked_invoices => Transaction::LinkedInvoice, :linked_credit_notes => Transaction::LinkedCreditNote, :linked_refunds => Transaction::LinkedRefund, :linked_payments => Transaction::LinkedPayment});
|
84
|
-
return transaction;
|
85
|
-
end
|
86
|
-
|
87
|
-
def hosted_page()
|
88
|
-
hosted_page = get(:hosted_page, HostedPage);
|
89
|
-
return hosted_page;
|
90
|
-
end
|
91
|
-
|
92
|
-
def estimate()
|
93
|
-
estimate = get(:estimate, Estimate, {},
|
94
|
-
{:subscription_estimate => SubscriptionEstimate, :invoice_estimate => InvoiceEstimate, :invoice_estimates => InvoiceEstimate, :next_invoice_estimate => InvoiceEstimate, :credit_note_estimates => CreditNoteEstimate, :unbilled_charge_estimates => UnbilledCharge});
|
95
|
-
estimate.init_dependant(@response[:estimate], :subscription_estimate,
|
96
|
-
{:shipping_address => SubscriptionEstimate::ShippingAddress});
|
97
|
-
estimate.init_dependant(@response[:estimate], :invoice_estimate,
|
98
|
-
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
99
|
-
estimate.init_dependant(@response[:estimate], :next_invoice_estimate,
|
100
|
-
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
101
|
-
estimate.init_dependant_list(@response[:estimate], :invoice_estimates,
|
102
|
-
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
103
|
-
estimate.init_dependant_list(@response[:estimate], :credit_note_estimates,
|
104
|
-
{:line_items => CreditNoteEstimate::LineItem, :discounts => CreditNoteEstimate::Discount, :taxes => CreditNoteEstimate::Tax, :line_item_taxes => CreditNoteEstimate::LineItemTax, :line_item_discounts => CreditNoteEstimate::LineItemDiscount, :line_item_tiers => CreditNoteEstimate::LineItemTier});
|
105
|
-
estimate.init_dependant_list(@response[:estimate], :unbilled_charge_estimates,
|
106
|
-
{:tiers => UnbilledCharge::Tier});
|
107
|
-
return estimate;
|
108
|
-
end
|
109
|
-
|
110
|
-
def quote()
|
111
|
-
quote = get(:quote, Quote,
|
112
|
-
{:line_items => Quote::LineItem, :discounts => Quote::Discount, :line_item_discounts => Quote::LineItemDiscount, :taxes => Quote::Tax, :line_item_taxes => Quote::LineItemTax, :shipping_address => Quote::ShippingAddress, :billing_address => Quote::BillingAddress});
|
113
|
-
return quote;
|
114
|
-
end
|
115
|
-
|
116
|
-
def plan()
|
117
|
-
plan = get(:plan, Plan,
|
118
|
-
{:tiers => Plan::Tier, :applicable_addons => Plan::ApplicableAddon, :attached_addons => Plan::AttachedAddon, :event_based_addons => Plan::EventBasedAddon});
|
119
|
-
return plan;
|
120
|
-
end
|
121
|
-
|
122
|
-
def addon()
|
123
|
-
addon = get(:addon, Addon,
|
124
|
-
{:tiers => Addon::Tier});
|
125
|
-
return addon;
|
126
|
-
end
|
127
|
-
|
128
|
-
def coupon()
|
129
|
-
coupon = get(:coupon, Coupon);
|
130
|
-
return coupon;
|
131
|
-
end
|
132
|
-
|
133
|
-
def coupon_set()
|
134
|
-
coupon_set = get(:coupon_set, CouponSet);
|
135
|
-
return coupon_set;
|
136
|
-
end
|
137
|
-
|
138
|
-
def coupon_code()
|
139
|
-
coupon_code = get(:coupon_code, CouponCode);
|
140
|
-
return coupon_code;
|
141
|
-
end
|
142
|
-
|
143
|
-
def address()
|
144
|
-
address = get(:address, Address);
|
145
|
-
return address;
|
146
|
-
end
|
147
|
-
|
148
|
-
def event()
|
149
|
-
event = get(:event, Event,
|
150
|
-
{:webhooks => Event::Webhook});
|
151
|
-
return event;
|
152
|
-
end
|
153
|
-
|
154
|
-
def comment()
|
155
|
-
comment = get(:comment, Comment);
|
156
|
-
return comment;
|
157
|
-
end
|
158
|
-
|
159
|
-
def download()
|
160
|
-
download = get(:download, Download);
|
161
|
-
return download;
|
162
|
-
end
|
163
|
-
|
164
|
-
def portal_session()
|
165
|
-
portal_session = get(:portal_session, PortalSession,
|
166
|
-
{:linked_customers => PortalSession::LinkedCustomer});
|
167
|
-
return portal_session;
|
168
|
-
end
|
169
|
-
|
170
|
-
def site_migration_detail()
|
171
|
-
site_migration_detail = get(:site_migration_detail, SiteMigrationDetail);
|
172
|
-
return site_migration_detail;
|
173
|
-
end
|
174
|
-
|
175
|
-
def resource_migration()
|
176
|
-
resource_migration = get(:resource_migration, ResourceMigration);
|
177
|
-
return resource_migration;
|
178
|
-
end
|
179
|
-
|
180
|
-
def time_machine()
|
181
|
-
time_machine = get(:time_machine, TimeMachine);
|
182
|
-
return time_machine;
|
183
|
-
end
|
184
|
-
|
185
|
-
def export()
|
186
|
-
export = get(:export, Export,
|
187
|
-
{:download => Export::Download});
|
188
|
-
return export;
|
189
|
-
end
|
190
|
-
|
191
|
-
|
192
|
-
def unbilled_charges()
|
193
|
-
unbilled_charges = get_list(:unbilled_charges, UnbilledCharge,
|
194
|
-
{:tiers => UnbilledCharge::Tier});
|
195
|
-
return unbilled_charges;
|
196
|
-
end
|
197
|
-
|
198
|
-
def credit_notes()
|
199
|
-
credit_notes = get_list(:credit_notes, CreditNote,
|
200
|
-
{:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :line_item_discounts => CreditNote::LineItemDiscount, :line_item_tiers => CreditNote::LineItemTier, :taxes => CreditNote::Tax, :line_item_taxes => CreditNote::LineItemTax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
|
201
|
-
return credit_notes;
|
202
|
-
end
|
203
|
-
|
204
|
-
def invoices()
|
205
|
-
invoices = get_list(:invoices, Invoice,
|
206
|
-
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
207
|
-
return invoices;
|
208
|
-
end
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
def
|
236
|
-
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|
240
|
-
end
|
1
|
+
module ChargeBee
|
2
|
+
class Result
|
3
|
+
|
4
|
+
def initialize(response)
|
5
|
+
@response = response
|
6
|
+
end
|
7
|
+
|
8
|
+
def subscription()
|
9
|
+
subscription = get(:subscription, Subscription,
|
10
|
+
{:addons => Subscription::Addon, :event_based_addons => Subscription::EventBasedAddon, :charged_event_based_addons => Subscription::ChargedEventBasedAddon, :coupons => Subscription::Coupon, :shipping_address => Subscription::ShippingAddress, :referral_info => Subscription::ReferralInfo});
|
11
|
+
return subscription;
|
12
|
+
end
|
13
|
+
|
14
|
+
def customer()
|
15
|
+
customer = get(:customer, Customer,
|
16
|
+
{:billing_address => Customer::BillingAddress, :referral_urls => Customer::ReferralUrl, :contacts => Customer::Contact, :payment_method => Customer::PaymentMethod, :balances => Customer::Balance});
|
17
|
+
return customer;
|
18
|
+
end
|
19
|
+
|
20
|
+
def contact()
|
21
|
+
contact = get(:contact, Contact);
|
22
|
+
return contact;
|
23
|
+
end
|
24
|
+
|
25
|
+
def payment_source()
|
26
|
+
payment_source = get(:payment_source, PaymentSource,
|
27
|
+
{:card => PaymentSource::Card, :bank_account => PaymentSource::BankAccount, :amazon_payment => PaymentSource::AmazonPayment, :paypal => PaymentSource::Paypal});
|
28
|
+
return payment_source;
|
29
|
+
end
|
30
|
+
|
31
|
+
def third_party_payment_method()
|
32
|
+
third_party_payment_method = get(:third_party_payment_method, ThirdPartyPaymentMethod);
|
33
|
+
return third_party_payment_method;
|
34
|
+
end
|
35
|
+
|
36
|
+
def virtual_bank_account()
|
37
|
+
virtual_bank_account = get(:virtual_bank_account, VirtualBankAccount);
|
38
|
+
return virtual_bank_account;
|
39
|
+
end
|
40
|
+
|
41
|
+
def card()
|
42
|
+
card = get(:card, Card);
|
43
|
+
return card;
|
44
|
+
end
|
45
|
+
|
46
|
+
def promotional_credit()
|
47
|
+
promotional_credit = get(:promotional_credit, PromotionalCredit);
|
48
|
+
return promotional_credit;
|
49
|
+
end
|
50
|
+
|
51
|
+
def invoice()
|
52
|
+
invoice = get(:invoice, Invoice,
|
53
|
+
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
54
|
+
return invoice;
|
55
|
+
end
|
56
|
+
|
57
|
+
def credit_note()
|
58
|
+
credit_note = get(:credit_note, CreditNote,
|
59
|
+
{:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :line_item_discounts => CreditNote::LineItemDiscount, :line_item_tiers => CreditNote::LineItemTier, :taxes => CreditNote::Tax, :line_item_taxes => CreditNote::LineItemTax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
|
60
|
+
return credit_note;
|
61
|
+
end
|
62
|
+
|
63
|
+
def unbilled_charge()
|
64
|
+
unbilled_charge = get(:unbilled_charge, UnbilledCharge,
|
65
|
+
{:tiers => UnbilledCharge::Tier});
|
66
|
+
return unbilled_charge;
|
67
|
+
end
|
68
|
+
|
69
|
+
def order()
|
70
|
+
order = get(:order, Order,
|
71
|
+
{:order_line_items => Order::OrderLineItem, :shipping_address => Order::ShippingAddress, :billing_address => Order::BillingAddress, :line_item_taxes => Order::LineItemTax, :line_item_discounts => Order::LineItemDiscount, :linked_credit_notes => Order::LinkedCreditNote});
|
72
|
+
return order;
|
73
|
+
end
|
74
|
+
|
75
|
+
def gift()
|
76
|
+
gift = get(:gift, Gift,
|
77
|
+
{:gifter => Gift::Gifter, :gift_receiver => Gift::GiftReceiver, :gift_timelines => Gift::GiftTimeline});
|
78
|
+
return gift;
|
79
|
+
end
|
80
|
+
|
81
|
+
def transaction()
|
82
|
+
transaction = get(:transaction, Transaction,
|
83
|
+
{:linked_invoices => Transaction::LinkedInvoice, :linked_credit_notes => Transaction::LinkedCreditNote, :linked_refunds => Transaction::LinkedRefund, :linked_payments => Transaction::LinkedPayment});
|
84
|
+
return transaction;
|
85
|
+
end
|
86
|
+
|
87
|
+
def hosted_page()
|
88
|
+
hosted_page = get(:hosted_page, HostedPage);
|
89
|
+
return hosted_page;
|
90
|
+
end
|
91
|
+
|
92
|
+
def estimate()
|
93
|
+
estimate = get(:estimate, Estimate, {},
|
94
|
+
{:subscription_estimate => SubscriptionEstimate, :invoice_estimate => InvoiceEstimate, :invoice_estimates => InvoiceEstimate, :next_invoice_estimate => InvoiceEstimate, :credit_note_estimates => CreditNoteEstimate, :unbilled_charge_estimates => UnbilledCharge});
|
95
|
+
estimate.init_dependant(@response[:estimate], :subscription_estimate,
|
96
|
+
{:shipping_address => SubscriptionEstimate::ShippingAddress});
|
97
|
+
estimate.init_dependant(@response[:estimate], :invoice_estimate,
|
98
|
+
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
99
|
+
estimate.init_dependant(@response[:estimate], :next_invoice_estimate,
|
100
|
+
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
101
|
+
estimate.init_dependant_list(@response[:estimate], :invoice_estimates,
|
102
|
+
{:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax, :line_item_taxes => InvoiceEstimate::LineItemTax, :line_item_tiers => InvoiceEstimate::LineItemTier, :line_item_discounts => InvoiceEstimate::LineItemDiscount});
|
103
|
+
estimate.init_dependant_list(@response[:estimate], :credit_note_estimates,
|
104
|
+
{:line_items => CreditNoteEstimate::LineItem, :discounts => CreditNoteEstimate::Discount, :taxes => CreditNoteEstimate::Tax, :line_item_taxes => CreditNoteEstimate::LineItemTax, :line_item_discounts => CreditNoteEstimate::LineItemDiscount, :line_item_tiers => CreditNoteEstimate::LineItemTier});
|
105
|
+
estimate.init_dependant_list(@response[:estimate], :unbilled_charge_estimates,
|
106
|
+
{:tiers => UnbilledCharge::Tier});
|
107
|
+
return estimate;
|
108
|
+
end
|
109
|
+
|
110
|
+
def quote()
|
111
|
+
quote = get(:quote, Quote,
|
112
|
+
{:line_items => Quote::LineItem, :discounts => Quote::Discount, :line_item_discounts => Quote::LineItemDiscount, :taxes => Quote::Tax, :line_item_taxes => Quote::LineItemTax, :shipping_address => Quote::ShippingAddress, :billing_address => Quote::BillingAddress});
|
113
|
+
return quote;
|
114
|
+
end
|
115
|
+
|
116
|
+
def plan()
|
117
|
+
plan = get(:plan, Plan,
|
118
|
+
{:tiers => Plan::Tier, :applicable_addons => Plan::ApplicableAddon, :attached_addons => Plan::AttachedAddon, :event_based_addons => Plan::EventBasedAddon});
|
119
|
+
return plan;
|
120
|
+
end
|
121
|
+
|
122
|
+
def addon()
|
123
|
+
addon = get(:addon, Addon,
|
124
|
+
{:tiers => Addon::Tier});
|
125
|
+
return addon;
|
126
|
+
end
|
127
|
+
|
128
|
+
def coupon()
|
129
|
+
coupon = get(:coupon, Coupon);
|
130
|
+
return coupon;
|
131
|
+
end
|
132
|
+
|
133
|
+
def coupon_set()
|
134
|
+
coupon_set = get(:coupon_set, CouponSet);
|
135
|
+
return coupon_set;
|
136
|
+
end
|
137
|
+
|
138
|
+
def coupon_code()
|
139
|
+
coupon_code = get(:coupon_code, CouponCode);
|
140
|
+
return coupon_code;
|
141
|
+
end
|
142
|
+
|
143
|
+
def address()
|
144
|
+
address = get(:address, Address);
|
145
|
+
return address;
|
146
|
+
end
|
147
|
+
|
148
|
+
def event()
|
149
|
+
event = get(:event, Event,
|
150
|
+
{:webhooks => Event::Webhook});
|
151
|
+
return event;
|
152
|
+
end
|
153
|
+
|
154
|
+
def comment()
|
155
|
+
comment = get(:comment, Comment);
|
156
|
+
return comment;
|
157
|
+
end
|
158
|
+
|
159
|
+
def download()
|
160
|
+
download = get(:download, Download);
|
161
|
+
return download;
|
162
|
+
end
|
163
|
+
|
164
|
+
def portal_session()
|
165
|
+
portal_session = get(:portal_session, PortalSession,
|
166
|
+
{:linked_customers => PortalSession::LinkedCustomer});
|
167
|
+
return portal_session;
|
168
|
+
end
|
169
|
+
|
170
|
+
def site_migration_detail()
|
171
|
+
site_migration_detail = get(:site_migration_detail, SiteMigrationDetail);
|
172
|
+
return site_migration_detail;
|
173
|
+
end
|
174
|
+
|
175
|
+
def resource_migration()
|
176
|
+
resource_migration = get(:resource_migration, ResourceMigration);
|
177
|
+
return resource_migration;
|
178
|
+
end
|
179
|
+
|
180
|
+
def time_machine()
|
181
|
+
time_machine = get(:time_machine, TimeMachine);
|
182
|
+
return time_machine;
|
183
|
+
end
|
184
|
+
|
185
|
+
def export()
|
186
|
+
export = get(:export, Export,
|
187
|
+
{:download => Export::Download});
|
188
|
+
return export;
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
def unbilled_charges()
|
193
|
+
unbilled_charges = get_list(:unbilled_charges, UnbilledCharge,
|
194
|
+
{:tiers => UnbilledCharge::Tier});
|
195
|
+
return unbilled_charges;
|
196
|
+
end
|
197
|
+
|
198
|
+
def credit_notes()
|
199
|
+
credit_notes = get_list(:credit_notes, CreditNote,
|
200
|
+
{:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :line_item_discounts => CreditNote::LineItemDiscount, :line_item_tiers => CreditNote::LineItemTier, :taxes => CreditNote::Tax, :line_item_taxes => CreditNote::LineItemTax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
|
201
|
+
return credit_notes;
|
202
|
+
end
|
203
|
+
|
204
|
+
def invoices()
|
205
|
+
invoices = get_list(:invoices, Invoice,
|
206
|
+
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
207
|
+
return invoices;
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
private
|
212
|
+
def get_list(type, klass, sub_types = {}, dependant_types = {}, dependant_sub_types = {})
|
213
|
+
if(@response[type] == nil)
|
214
|
+
return nil
|
215
|
+
end
|
216
|
+
set_val = Array.new
|
217
|
+
@response[type].each do |obj|
|
218
|
+
case obj
|
219
|
+
when Hash
|
220
|
+
model = klass.construct(obj, sub_types, dependant_types)
|
221
|
+
dependant_sub_types.each do |k,v|
|
222
|
+
model.init_dependant(obj, k, v);
|
223
|
+
end
|
224
|
+
set_val.push(model)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
return instance_variable_set("@#{type}", set_val)
|
228
|
+
end
|
229
|
+
|
230
|
+
private
|
231
|
+
def get(type, klass, sub_types = {}, dependant_types = {})
|
232
|
+
return klass.construct(@response[type], sub_types, dependant_types)
|
233
|
+
end
|
234
|
+
|
235
|
+
def to_s(*args)
|
236
|
+
JSON.pretty_generate(@response)
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
end
|
data/lib/chargebee.rb
CHANGED
@@ -1,85 +1,85 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/chargebee/environment'
|
2
|
-
require File.dirname(__FILE__) + '/chargebee/rest'
|
3
|
-
require File.dirname(__FILE__) + '/chargebee/util'
|
4
|
-
require File.dirname(__FILE__) + '/chargebee/request'
|
5
|
-
require File.dirname(__FILE__) + '/chargebee/result'
|
6
|
-
require File.dirname(__FILE__) + '/chargebee/list_result'
|
7
|
-
|
8
|
-
require File.dirname(__FILE__) + '/chargebee/errors'
|
9
|
-
|
10
|
-
require File.dirname(__FILE__) + '/chargebee/models/model'
|
11
|
-
require File.dirname(__FILE__) + '/chargebee/models/subscription'
|
12
|
-
require File.dirname(__FILE__) + '/chargebee/models/customer'
|
13
|
-
require File.dirname(__FILE__) + '/chargebee/models/card'
|
14
|
-
require File.dirname(__FILE__) + '/chargebee/models/third_party_payment_method'
|
15
|
-
require File.dirname(__FILE__) + '/chargebee/models/address'
|
16
|
-
require File.dirname(__FILE__) + '/chargebee/models/transaction'
|
17
|
-
require File.dirname(__FILE__) + '/chargebee/models/invoice'
|
18
|
-
require File.dirname(__FILE__) + '/chargebee/models/order'
|
19
|
-
require File.dirname(__FILE__) + '/chargebee/models/credit_note'
|
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'
|
24
|
-
require File.dirname(__FILE__) + '/chargebee/models/hosted_page'
|
25
|
-
require File.dirname(__FILE__) + '/chargebee/models/event'
|
26
|
-
require File.dirname(__FILE__) + '/chargebee/models/plan'
|
27
|
-
require File.dirname(__FILE__) + '/chargebee/models/addon'
|
28
|
-
require File.dirname(__FILE__) + '/chargebee/models/coupon'
|
29
|
-
require File.dirname(__FILE__) + '/chargebee/models/coupon_code'
|
30
|
-
require File.dirname(__FILE__) + '/chargebee/models/coupon_set'
|
31
|
-
require File.dirname(__FILE__) + '/chargebee/models/comment'
|
32
|
-
require File.dirname(__FILE__) + '/chargebee/models/portal_session'
|
33
|
-
require File.dirname(__FILE__) + '/chargebee/models/download'
|
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'
|
45
|
-
|
46
|
-
module ChargeBee
|
47
|
-
|
48
|
-
VERSION = '2.6.
|
49
|
-
|
50
|
-
@@default_env = nil
|
51
|
-
@@verify_ca_certs = true
|
52
|
-
@@ca_cert_path = File.join(File.dirname(__FILE__), '/ssl/ca-certs.crt')
|
53
|
-
@@user_agent = "Chargebee-Ruby-Client v#{self::VERSION}"
|
54
|
-
|
55
|
-
def self.configure(options)
|
56
|
-
@@default_env = Environment.new(options)
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.default_env
|
60
|
-
@@default_env
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.verify_ca_certs=(verify)
|
64
|
-
@@verify_ca_certs = verify
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.verify_ca_certs?
|
68
|
-
@@verify_ca_certs
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.ca_cert_path
|
72
|
-
@@ca_cert_path
|
73
|
-
end
|
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
|
-
|
84
|
-
end
|
85
|
-
|
1
|
+
require File.dirname(__FILE__) + '/chargebee/environment'
|
2
|
+
require File.dirname(__FILE__) + '/chargebee/rest'
|
3
|
+
require File.dirname(__FILE__) + '/chargebee/util'
|
4
|
+
require File.dirname(__FILE__) + '/chargebee/request'
|
5
|
+
require File.dirname(__FILE__) + '/chargebee/result'
|
6
|
+
require File.dirname(__FILE__) + '/chargebee/list_result'
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + '/chargebee/errors'
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + '/chargebee/models/model'
|
11
|
+
require File.dirname(__FILE__) + '/chargebee/models/subscription'
|
12
|
+
require File.dirname(__FILE__) + '/chargebee/models/customer'
|
13
|
+
require File.dirname(__FILE__) + '/chargebee/models/card'
|
14
|
+
require File.dirname(__FILE__) + '/chargebee/models/third_party_payment_method'
|
15
|
+
require File.dirname(__FILE__) + '/chargebee/models/address'
|
16
|
+
require File.dirname(__FILE__) + '/chargebee/models/transaction'
|
17
|
+
require File.dirname(__FILE__) + '/chargebee/models/invoice'
|
18
|
+
require File.dirname(__FILE__) + '/chargebee/models/order'
|
19
|
+
require File.dirname(__FILE__) + '/chargebee/models/credit_note'
|
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'
|
24
|
+
require File.dirname(__FILE__) + '/chargebee/models/hosted_page'
|
25
|
+
require File.dirname(__FILE__) + '/chargebee/models/event'
|
26
|
+
require File.dirname(__FILE__) + '/chargebee/models/plan'
|
27
|
+
require File.dirname(__FILE__) + '/chargebee/models/addon'
|
28
|
+
require File.dirname(__FILE__) + '/chargebee/models/coupon'
|
29
|
+
require File.dirname(__FILE__) + '/chargebee/models/coupon_code'
|
30
|
+
require File.dirname(__FILE__) + '/chargebee/models/coupon_set'
|
31
|
+
require File.dirname(__FILE__) + '/chargebee/models/comment'
|
32
|
+
require File.dirname(__FILE__) + '/chargebee/models/portal_session'
|
33
|
+
require File.dirname(__FILE__) + '/chargebee/models/download'
|
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'
|
45
|
+
|
46
|
+
module ChargeBee
|
47
|
+
|
48
|
+
VERSION = '2.6.5'
|
49
|
+
|
50
|
+
@@default_env = nil
|
51
|
+
@@verify_ca_certs = true
|
52
|
+
@@ca_cert_path = File.join(File.dirname(__FILE__), '/ssl/ca-certs.crt')
|
53
|
+
@@user_agent = "Chargebee-Ruby-Client v#{self::VERSION}"
|
54
|
+
|
55
|
+
def self.configure(options)
|
56
|
+
@@default_env = Environment.new(options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.default_env
|
60
|
+
@@default_env
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.verify_ca_certs=(verify)
|
64
|
+
@@verify_ca_certs = verify
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.verify_ca_certs?
|
68
|
+
@@verify_ca_certs
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.ca_cert_path
|
72
|
+
@@ca_cert_path
|
73
|
+
end
|
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
|
+
|
84
|
+
end
|
85
|
+
|