chargebee 1.7.5 → 2.0.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,9 +1,9 @@
1
1
  module ChargeBee
2
2
  class Card < Model
3
3
 
4
- attr_accessor :status, :gateway, :reference_id, :first_name, :last_name, :iin, :last4, :card_type,
4
+ attr_accessor :customer_id, :status, :gateway, :first_name, :last_name, :iin, :last4, :card_type,
5
5
  :expiry_month, :expiry_year, :billing_addr1, :billing_addr2, :billing_city, :billing_state_code,
6
- :billing_state, :billing_country, :billing_zip, :ip_address, :customer_id, :masked_number
6
+ :billing_state, :billing_country, :billing_zip, :ip_address, :masked_number
7
7
 
8
8
  # OPERATIONS
9
9
  #-----------
@@ -16,10 +16,6 @@ module ChargeBee
16
16
  Request.send('post', uri_path("customers",id.to_s,"credit_card"), params, env, headers)
17
17
  end
18
18
 
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
19
  def self.switch_gateway_for_customer(id, params, env=nil, headers={})
24
20
  Request.send('post', uri_path("customers",id.to_s,"switch_gateway"), params, env, headers)
25
21
  end
@@ -0,0 +1,44 @@
1
+ module ChargeBee
2
+ class CreditNote < Model
3
+
4
+ class LineItem < Model
5
+ attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax_amount, :tax_rate, :amount, :discount_amount, :item_level_discount_amount, :description, :entity_type, :entity_id
6
+ end
7
+
8
+ class Discount < Model
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class Tax < Model
13
+ attr_accessor :amount, :description
14
+ end
15
+
16
+ class LinkedRefund < Model
17
+ attr_accessor :txn_id, :applied_amount, :applied_at, :txn_status, :txn_date, :txn_amount
18
+ end
19
+
20
+ class Allocation < Model
21
+ attr_accessor :invoice_id, :allocated_amount, :allocated_at, :invoice_date, :invoice_status
22
+ end
23
+
24
+ attr_accessor :id, :customer_id, :subscription_id, :reference_invoice_id, :type, :reason_code,
25
+ :status, :vat_number, :date, :price_type, :total, :amount_allocated, :amount_refunded, :amount_available,
26
+ :refunded_at, :sub_total, :line_items, :discounts, :taxes, :linked_refunds, :allocations
27
+
28
+ # OPERATIONS
29
+ #-----------
30
+
31
+ def self.retrieve(id, env=nil, headers={})
32
+ Request.send('get', uri_path("credit_notes",id.to_s), {}, env, headers)
33
+ end
34
+
35
+ def self.list(params={}, env=nil, headers={})
36
+ Request.send('get', uri_path("credit_notes"), params, env, headers)
37
+ end
38
+
39
+ def self.credit_notes_for_customer(id, params={}, env=nil, headers={})
40
+ Request.send('get', uri_path("customers",id.to_s,"credit_notes"), params, env, headers)
41
+ end
42
+
43
+ end # ~CreditNote
44
+ end # ~ChargeBee
@@ -0,0 +1,23 @@
1
+ module ChargeBee
2
+ class CreditNoteEstimate < Model
3
+
4
+ class LineItem < Model
5
+ attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax_amount, :tax_rate, :amount, :discount_amount, :item_level_discount_amount, :description, :entity_type, :entity_id
6
+ end
7
+
8
+ class Discount < Model
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class Tax < Model
13
+ attr_accessor :amount, :description
14
+ end
15
+
16
+ attr_accessor :reference_invoice_id, :type, :price_type, :sub_total, :total, :amount_allocated,
17
+ :amount_available, :line_items, :discounts, :taxes
18
+
19
+ # OPERATIONS
20
+ #-----------
21
+
22
+ end # ~CreditNoteEstimate
23
+ end # ~ChargeBee
@@ -15,7 +15,7 @@ module ChargeBee
15
15
 
16
16
  attr_accessor :id, :first_name, :last_name, :email, :phone, :company, :vat_number, :auto_collection,
17
17
  :allow_direct_debit, :created_at, :created_from_ip, :taxability, :card_status, :billing_address,
18
- :contacts, :payment_method, :invoice_notes, :account_credits, :refundable_credits, :excess_payments,
18
+ :contacts, :payment_method, :invoice_notes, :promotional_credits, :refundable_credits, :excess_payments,
19
19
  :meta_data
20
20
 
21
21
  # OPERATIONS
@@ -57,16 +57,16 @@ module ChargeBee
57
57
  Request.send('post', uri_path("customers",id.to_s,"delete_contact"), params, env, headers)
58
58
  end
59
59
 
60
- def self.add_account_credits(id, params, env=nil, headers={})
61
- Request.send('post', uri_path("customers",id.to_s,"add_account_credits"), params, env, headers)
60
+ def self.add_promotional_credits(id, params, env=nil, headers={})
61
+ Request.send('post', uri_path("customers",id.to_s,"add_promotional_credits"), params, env, headers)
62
62
  end
63
63
 
64
- def self.deduct_account_credits(id, params, env=nil, headers={})
65
- Request.send('post', uri_path("customers",id.to_s,"deduct_account_credits"), params, env, headers)
64
+ def self.deduct_promotional_credits(id, params, env=nil, headers={})
65
+ Request.send('post', uri_path("customers",id.to_s,"deduct_promotional_credits"), params, env, headers)
66
66
  end
67
67
 
68
- def self.set_account_credits(id, params, env=nil, headers={})
69
- Request.send('post', uri_path("customers",id.to_s,"set_account_credits"), params, env, headers)
68
+ def self.set_promotional_credits(id, params, env=nil, headers={})
69
+ Request.send('post', uri_path("customers",id.to_s,"set_promotional_credits"), params, env, headers)
70
70
  end
71
71
 
72
72
  def self.delete(id, params={}, env=nil, headers={})
@@ -1,21 +1,7 @@
1
1
  module ChargeBee
2
2
  class Estimate < Model
3
3
 
4
- class LineItem < Model
5
- attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax, :tax_rate, :amount, :description, :type, :entity_type, :entity_id
6
- end
7
-
8
- class Discount < Model
9
- attr_accessor :amount, :description, :type, :entity_id
10
- end
11
-
12
- class Tax < Model
13
- attr_accessor :amount, :description
14
- end
15
-
16
- attr_accessor :created_at, :recurring, :subscription_id, :subscription_status, :term_ends_at,
17
- :collect_now, :price_type, :amount, :credits_applied, :amount_due, :sub_total, :line_items,
18
- :discounts, :taxes
4
+ attr_accessor :created_at, :subscription_estimate, :invoice_estimate, :credit_note_estimates
19
5
 
20
6
  # OPERATIONS
21
7
  #-----------
@@ -34,14 +34,6 @@ module ChargeBee
34
34
  Request.send('post', uri_path("hosted_pages","update_payment_method"), params, env, headers)
35
35
  end
36
36
 
37
- def self.checkout_onetime_charge(params, env=nil, headers={})
38
- Request.send('post', uri_path("hosted_pages","checkout_onetime_charge"), params, env, headers)
39
- end
40
-
41
- def self.checkout_onetime_addons(params, env=nil, headers={})
42
- Request.send('post', uri_path("hosted_pages","checkout_onetime_addons"), params, env, headers)
43
- end
44
-
45
37
  def self.retrieve(id, env=nil, headers={})
46
38
  Request.send('get', uri_path("hosted_pages",id.to_s), {}, env, headers)
47
39
  end
@@ -2,19 +2,31 @@ module ChargeBee
2
2
  class Invoice < Model
3
3
 
4
4
  class LineItem < Model
5
- attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax, :tax_rate, :amount, :description, :type, :entity_type, :entity_id
5
+ attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax_amount, :tax_rate, :amount, :discount_amount, :item_level_discount_amount, :description, :entity_type, :entity_id
6
6
  end
7
7
 
8
8
  class Discount < Model
9
- attr_accessor :amount, :description, :type, :entity_id
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
10
  end
11
11
 
12
12
  class Tax < Model
13
13
  attr_accessor :amount, :description
14
14
  end
15
15
 
16
- class LinkedTransaction < Model
17
- attr_accessor :txn_id, :applied_amount, :applied_at, :txn_type, :txn_status, :txn_date, :txn_amount
16
+ class LinkedPayment < Model
17
+ attr_accessor :txn_id, :applied_amount, :applied_at, :txn_status, :txn_date, :txn_amount
18
+ end
19
+
20
+ class AppliedCredit < Model
21
+ attr_accessor :cn_id, :applied_amount, :applied_at, :cn_reason_code, :cn_date, :cn_status
22
+ end
23
+
24
+ class AdjustmentCreditNote < Model
25
+ attr_accessor :cn_id, :cn_reason_code, :cn_date, :cn_total, :cn_status
26
+ end
27
+
28
+ class IssuedCreditNote < Model
29
+ attr_accessor :cn_id, :cn_reason_code, :cn_date, :cn_total, :cn_status
18
30
  end
19
31
 
20
32
  class LinkedOrder < Model
@@ -34,10 +46,10 @@ module ChargeBee
34
46
  end
35
47
 
36
48
  attr_accessor :id, :po_number, :customer_id, :subscription_id, :recurring, :status, :vat_number,
37
- :price_type, :start_date, :end_date, :amount, :amount_paid, :amount_adjusted, :credits_applied,
38
- :amount_due, :paid_on, :dunning_status, :next_retry, :sub_total, :tax, :first_invoice, :currency_code,
39
- :line_items, :discounts, :taxes, :linked_transactions, :linked_orders, :notes, :shipping_address,
40
- :billing_address
49
+ :price_type, :date, :total, :amount_paid, :amount_adjusted, :write_off_amount, :credits_applied,
50
+ :amount_due, :paid_at, :dunning_status, :next_retry_at, :sub_total, :tax, :first_invoice, :currency_code,
51
+ :line_items, :discounts, :taxes, :linked_payments, :applied_credits, :adjustment_credit_notes,
52
+ :issued_credit_notes, :linked_orders, :notes, :shipping_address, :billing_address
41
53
 
42
54
  # OPERATIONS
43
55
  #-----------
@@ -86,14 +98,18 @@ module ChargeBee
86
98
  Request.send('post', uri_path("invoices",id.to_s,"add_addon_charge"), params, env, headers)
87
99
  end
88
100
 
89
- def self.collect(id, env=nil, headers={})
90
- Request.send('post', uri_path("invoices",id.to_s,"collect"), {}, env, headers)
101
+ def self.close(id, env=nil, headers={})
102
+ Request.send('post', uri_path("invoices",id.to_s,"close"), {}, env, headers)
91
103
  end
92
104
 
93
105
  def self.collect_payment(id, params={}, env=nil, headers={})
94
106
  Request.send('post', uri_path("invoices",id.to_s,"collect_payment"), params, env, headers)
95
107
  end
96
108
 
109
+ def self.record_payment(id, params, env=nil, headers={})
110
+ Request.send('post', uri_path("invoices",id.to_s,"record_payment"), params, env, headers)
111
+ end
112
+
97
113
  def self.refund(id, params={}, env=nil, headers={})
98
114
  Request.send('post', uri_path("invoices",id.to_s,"refund"), params, env, headers)
99
115
  end
@@ -0,0 +1,23 @@
1
+ module ChargeBee
2
+ class InvoiceEstimate < Model
3
+
4
+ class LineItem < Model
5
+ attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax_amount, :tax_rate, :amount, :discount_amount, :item_level_discount_amount, :description, :entity_type, :entity_id
6
+ end
7
+
8
+ class Discount < Model
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class Tax < Model
13
+ attr_accessor :amount, :description
14
+ end
15
+
16
+ attr_accessor :recurring, :price_type, :sub_total, :total, :credits_applied, :amount_paid, :amount_due,
17
+ :line_items, :discounts, :taxes
18
+
19
+ # OPERATIONS
20
+ #-----------
21
+
22
+ end # ~InvoiceEstimate
23
+ end # ~ChargeBee
@@ -3,9 +3,10 @@ require 'uri'
3
3
  module ChargeBee
4
4
  class Model
5
5
 
6
- def initialize(values, sub_types={})
6
+ def initialize(values, sub_types={}, dependant_types={})
7
7
  @values = values
8
8
  @sub_types = sub_types
9
+ @dependant_types = dependant_types
9
10
  end
10
11
 
11
12
  def to_s(*args)
@@ -21,6 +22,8 @@ module ChargeBee
21
22
  values.each do |k, v|
22
23
  set_val = nil
23
24
  case v
25
+ when Hash && (@dependant_types[k] != nil)
26
+ next
24
27
  when Hash
25
28
  set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
26
29
  when Array
@@ -58,13 +61,41 @@ module ChargeBee
58
61
  return url
59
62
  end
60
63
 
61
- def self.construct(values, sub_types = {})
64
+ def self.construct(values, sub_types = {}, dependant_types = {})
62
65
  if(values != nil)
63
- obj = self.new(values, sub_types)
66
+ obj = self.new(values, sub_types, dependant_types)
64
67
  obj.load(values)
65
68
  obj
66
69
  end
67
70
  end
68
71
 
72
+ def init_dependant(obj, type, sub_types = {})
73
+ instance_eval do
74
+ if(obj[type] != nil)
75
+ case obj
76
+ when Hash
77
+ if(@dependant_types[type] != nil)
78
+ dependant_obj = @dependant_types[type].construct(obj[type], sub_types)
79
+ instance_variable_set("@#{type}", dependant_obj)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ def init_dependant_list(obj, type, sub_types = {})
87
+ instance_eval do
88
+ if(obj[type] != nil)
89
+ case obj[type]
90
+ when Array
91
+ if(@dependant_types[type] != nil)
92
+ set_val = obj[type].map {|dt| @dependant_types[type].construct(dt, sub_types)}
93
+ instance_variable_set("@#{type}", set_val)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+
69
100
  end
70
101
  end
@@ -0,0 +1,10 @@
1
+ module ChargeBee
2
+ class SubscriptionEstimate < Model
3
+
4
+ attr_accessor :id, :status, :next_billing_at
5
+
6
+ # OPERATIONS
7
+ #-----------
8
+
9
+ end # ~SubscriptionEstimate
10
+ end # ~ChargeBee
@@ -2,7 +2,11 @@ module ChargeBee
2
2
  class Transaction < Model
3
3
 
4
4
  class LinkedInvoice < Model
5
- attr_accessor :invoice_id, :applied_amount, :applied_at, :invoice_date, :invoice_amount
5
+ attr_accessor :invoice_id, :applied_amount, :applied_at, :invoice_date, :invoice_total, :invoice_status
6
+ end
7
+
8
+ class LinkedCreditNote < Model
9
+ attr_accessor :cn_id, :applied_amount, :applied_at, :cn_reason_code, :cn_date, :cn_total, :cn_status, :cn_reference_invoice_id
6
10
  end
7
11
 
8
12
  class LinkedRefund < Model
@@ -10,9 +14,9 @@ module ChargeBee
10
14
  end
11
15
 
12
16
  attr_accessor :id, :customer_id, :subscription_id, :payment_method, :reference_number, :gateway,
13
- :description, :type, :date, :currency_code, :amount, :id_at_gateway, :status, :initiator_type,
14
- :three_d_secure, :error_code, :error_text, :voided_at, :void_description, :amount_unused, :masked_card_number,
15
- :reference_transaction_id, :refunded_txn_id, :reversal_transaction_id, :linked_invoices, :linked_refunds
17
+ :type, :date, :amount, :id_at_gateway, :status, :error_code, :error_text, :voided_at, :amount_unused,
18
+ :masked_card_number, :reference_transaction_id, :refunded_txn_id, :reversal_transaction_id,
19
+ :linked_invoices, :linked_credit_notes, :linked_refunds, :currency_code
16
20
 
17
21
  # OPERATIONS
18
22
  #-----------
@@ -29,17 +33,13 @@ module ChargeBee
29
33
  Request.send('get', uri_path("subscriptions",id.to_s,"transactions"), params, env, headers)
30
34
  end
31
35
 
32
- def self.transactions_for_invoice(id, params={}, env=nil, headers={})
33
- Request.send('get', uri_path("invoices",id.to_s,"transactions"), params, env, headers)
36
+ def self.payments_for_invoice(id, params={}, env=nil, headers={})
37
+ Request.send('get', uri_path("invoices",id.to_s,"payments"), params, env, headers)
34
38
  end
35
39
 
36
40
  def self.retrieve(id, env=nil, headers={})
37
41
  Request.send('get', uri_path("transactions",id.to_s), {}, env, headers)
38
42
  end
39
43
 
40
- def self.record_payment(id, params, env=nil, headers={})
41
- Request.send('post', uri_path("invoices",id.to_s,"record_payment"), params, env, headers)
42
- end
43
-
44
44
  end # ~Transaction
45
45
  end # ~ChargeBee
@@ -6,90 +6,139 @@ module ChargeBee
6
6
  end
7
7
 
8
8
  def subscription()
9
- get(:subscription, Subscription,
9
+ subscription = get(:subscription, Subscription,
10
10
  {:addons => Subscription::Addon, :coupons => Subscription::Coupon, :shipping_address => Subscription::ShippingAddress});
11
+ return subscription;
11
12
  end
12
13
 
13
14
  def customer()
14
- get(:customer, Customer,
15
+ customer = get(:customer, Customer,
15
16
  {:billing_address => Customer::BillingAddress, :contacts => Customer::Contact, :payment_method => Customer::PaymentMethod});
17
+ return customer;
16
18
  end
17
19
 
18
20
  def card()
19
- get(:card, Card);
21
+ card = get(:card, Card);
22
+ return card;
20
23
  end
21
24
 
22
25
  def invoice()
23
- get(:invoice, Invoice,
24
- {:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :taxes => Invoice::Tax, :linked_transactions => Invoice::LinkedTransaction, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
26
+ invoice = get(:invoice, Invoice,
27
+ {:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :taxes => Invoice::Tax, :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});
28
+ return invoice;
29
+ end
30
+
31
+ def credit_note()
32
+ credit_note = get(:credit_note, CreditNote,
33
+ {:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :taxes => CreditNote::Tax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
34
+ return credit_note;
25
35
  end
26
36
 
27
37
  def order()
28
- get(:order, Order);
38
+ order = get(:order, Order);
39
+ return order;
29
40
  end
30
41
 
31
42
  def transaction()
32
- get(:transaction, Transaction,
33
- {:linked_invoices => Transaction::LinkedInvoice, :linked_refunds => Transaction::LinkedRefund});
43
+ transaction = get(:transaction, Transaction,
44
+ {:linked_invoices => Transaction::LinkedInvoice, :linked_credit_notes => Transaction::LinkedCreditNote, :linked_refunds => Transaction::LinkedRefund});
45
+ return transaction;
34
46
  end
35
47
 
36
48
  def hosted_page()
37
- get(:hosted_page, HostedPage);
49
+ hosted_page = get(:hosted_page, HostedPage);
50
+ return hosted_page;
38
51
  end
39
52
 
40
53
  def estimate()
41
- get(:estimate, Estimate,
42
- {:line_items => Estimate::LineItem, :discounts => Estimate::Discount, :taxes => Estimate::Tax});
54
+ estimate = get(:estimate, Estimate, {},
55
+ {:subscription_estimate => SubscriptionEstimate, :invoice_estimate => InvoiceEstimate, :credit_note_estimates => CreditNoteEstimate});
56
+ estimate.init_dependant(@response[:estimate], :subscription_estimate,
57
+ {});
58
+ estimate.init_dependant(@response[:estimate], :invoice_estimate,
59
+ {:line_items => InvoiceEstimate::LineItem, :discounts => InvoiceEstimate::Discount, :taxes => InvoiceEstimate::Tax});
60
+ estimate.init_dependant_list(@response[:estimate], :credit_note_estimates,
61
+ {:line_items => CreditNoteEstimate::LineItem, :discounts => CreditNoteEstimate::Discount, :taxes => CreditNoteEstimate::Tax});
62
+ return estimate;
43
63
  end
44
64
 
45
65
  def plan()
46
- get(:plan, Plan);
66
+ plan = get(:plan, Plan);
67
+ return plan;
47
68
  end
48
69
 
49
70
  def addon()
50
- get(:addon, Addon);
71
+ addon = get(:addon, Addon);
72
+ return addon;
51
73
  end
52
74
 
53
75
  def coupon()
54
- get(:coupon, Coupon);
76
+ coupon = get(:coupon, Coupon);
77
+ return coupon;
55
78
  end
56
79
 
57
80
  def coupon_code()
58
- get(:coupon_code, CouponCode);
81
+ coupon_code = get(:coupon_code, CouponCode);
82
+ return coupon_code;
59
83
  end
60
84
 
61
85
  def address()
62
- get(:address, Address);
86
+ address = get(:address, Address);
87
+ return address;
63
88
  end
64
89
 
65
90
  def event()
66
- get(:event, Event,
91
+ event = get(:event, Event,
67
92
  {:webhooks => Event::Webhook});
93
+ return event;
68
94
  end
69
95
 
70
96
  def comment()
71
- get(:comment, Comment);
97
+ comment = get(:comment, Comment);
98
+ return comment;
72
99
  end
73
100
 
74
101
  def download()
75
- get(:download, Download);
102
+ download = get(:download, Download);
103
+ return download;
76
104
  end
77
105
 
78
106
  def portal_session()
79
- get(:portal_session, PortalSession,
107
+ portal_session = get(:portal_session, PortalSession,
80
108
  {:linked_customers => PortalSession::LinkedCustomer});
109
+ return portal_session;
81
110
  end
82
111
 
83
- def payment_intent()
84
- get(:payment_intent, PaymentIntent,
85
- {:payment_attempt => PaymentIntent::PaymentAttempt});
86
- end
87
112
 
113
+ def credit_notes()
114
+ credit_notes = get_list(:credit_notes, CreditNote,
115
+ {:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :taxes => CreditNote::Tax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
116
+ return credit_notes;
117
+ end
118
+
88
119
 
120
+ private
121
+ def get_list(type, klass, sub_types = {}, dependant_types = {}, dependant_sub_types = {})
122
+ if(@response[type] == nil)
123
+ return nil
124
+ end
125
+ set_val = Array.new
126
+ @response[type].each do |obj|
127
+ case obj
128
+ when Hash
129
+ model = klass.construct(obj, sub_types, dependant_types)
130
+ dependant_sub_types.each do |k,v|
131
+ model.init_dependant(obj, k, v);
132
+ end
133
+ set_val.push(model)
134
+ end
135
+ end
136
+ return instance_variable_set("@#{type}", set_val)
137
+ end
89
138
 
90
139
  private
91
- def get(type, klass, sub_types = {})
92
- klass.construct(@response[type], sub_types)
140
+ def get(type, klass, sub_types = {}, dependant_types = {})
141
+ return klass.construct(@response[type], sub_types, dependant_types)
93
142
  end
94
143
 
95
144
  def to_s(*args)