Class: KillBillClient::Model::Account
Constant Summary
collapse
- KILLBILL_API_ACCOUNTS_PREFIX =
"#{KILLBILL_API_PREFIX}/accounts"
Constants included
from TagHelper
TagHelper::AUTO_INVOICING_OFF_ID, TagHelper::AUTO_PAY_OFF_ID, TagHelper::MANUAL_PAY_ID, TagHelper::OVERDUE_ENFORCEMENT_OFF_ID, TagHelper::TEST_ID, TagHelper::WRITTEN_OFF_ID
Class Method Summary
collapse
-
.find_by_external_key(external_key, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
-
.find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
-
.find_children(account_id, with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
-
.find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
-
.find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
Instance Method Summary
collapse
-
#add_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#all_custom_fields(object_type, audit = 'NONE', options = {}) ⇒ Object
-
#all_tags(object_type, included_deleted, audit = 'NONE', options = {}) ⇒ Object
-
#auto_invoicing_off?(options = {}) ⇒ Boolean
-
#auto_pay_off?(options = {}) ⇒ Boolean
-
#bundles(options = {}) ⇒ Object
-
#children(with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
-
#close(cancel_subscriptions, writeoff_unpaid_invoices, item_adjust_unpaid_invoices, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#emails(audit = 'NONE', options = {}) ⇒ Object
-
#invoices(with_items = false, options = {}) ⇒ Object
-
#manual_pay?(options = {}) ⇒ Boolean
-
#overdue(options = {}) ⇒ Object
-
#overdue_enforcement_off?(options = {}) ⇒ Boolean
-
#payments(options = {}) ⇒ Object
-
#remove_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#remove_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#set_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#test?(options = {}) ⇒ Boolean
-
#transfer_child_credit(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#update(treat_null_as_reset = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#update_email_notifications(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#written_off?(options = {}) ⇒ Boolean
included
Methods included from TagHelper
#add_tag, #add_tag_from_definition_id, #control_tag?, included, #remove_tag, #remove_tag_from_definition_id, #set_tags
Class Method Details
.find_by_external_key(external_key, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/killbill_client/models/account.rb', line 36
def find_by_external_key(external_key, with_balance = false, with_balance_and_cba = false, options = {})
get "#{KILLBILL_API_ACCOUNTS_PREFIX}",
{
:externalKey => external_key,
:accountWithBalance => with_balance,
:accountWithBalanceAndCBA => with_balance_and_cba
},
options
end
|
.find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/killbill_client/models/account.rb', line 27
def find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {})
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
{
:accountWithBalance => with_balance,
:accountWithBalanceAndCBA => with_balance_and_cba
},
options
end
|
.find_children(account_id, with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/killbill_client/models/account.rb', line 57
def find_children(account_id, with_balance = false, with_balance_and_cba = false, audit='NONE', options = {})
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/children",
{
:audit => audit,
:accountWithBalance => with_balance,
:accountWithBalanceAndCBA => with_balance_and_cba
},
options
end
|
.find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/killbill_client/models/account.rb', line 16
def find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
{
:offset => offset,
:limit => limit,
:accountWithBalance => with_balance,
:accountWithBalanceAndCBA => with_balance_and_cba
},
options
end
|
.find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/killbill_client/models/account.rb', line 46
def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/search/#{search_key}",
{
:offset => offset,
:limit => limit,
:accountWithBalance => with_balance,
:accountWithBalanceAndCBA => with_balance_and_cba
},
options
end
|
Instance Method Details
#add_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
# File 'lib/killbill_client/models/account.rb', line 233
def add_email(email, user = nil, reason = nil, = nil, options = {})
self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails",
{
:accountId => account_id,
:email => email
}.to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#all_custom_fields(object_type, audit = 'NONE', options = {}) ⇒ Object
291
292
293
294
295
296
297
298
299
|
# File 'lib/killbill_client/models/account.rb', line 291
def all_custom_fields(object_type, audit = 'NONE', options = {})
params = {}
params[:objectType] = object_type if object_type
params[:audit] = audit
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/allCustomFields",
params,
options,
CustomField
end
|
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/killbill_client/models/account.rb', line 279
def all_tags(object_type, included_deleted, audit = 'NONE', options = {})
params = {}
params[:objectType] = object_type if object_type
params[:includedDeleted] = included_deleted if included_deleted
params[:audit] = audit
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/allTags",
params,
options,
Tag
end
|
#auto_invoicing_off?(options = {}) ⇒ Boolean
173
174
175
|
# File 'lib/killbill_client/models/account.rb', line 173
def auto_invoicing_off?(options = {})
control_tag?(AUTO_INVOICING_OFF_ID, options)
end
|
#auto_pay_off?(options = {}) ⇒ Boolean
161
162
163
|
# File 'lib/killbill_client/models/account.rb', line 161
def auto_pay_off?(options = {})
control_tag?(AUTO_PAY_OFF_ID, options)
end
|
#bundles(options = {}) ⇒ Object
127
128
129
130
131
132
|
# File 'lib/killbill_client/models/account.rb', line 127
def bundles(options = {})
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/bundles",
{},
options,
Bundle
end
|
#children(with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
157
158
159
|
# File 'lib/killbill_client/models/account.rb', line 157
def children(with_balance = false, with_balance_and_cba = false, audit='NONE', options = {})
Account::find_children(self.account_id, with_balance, with_balance_and_cba, audit, options)
end
|
#close(cancel_subscriptions, writeoff_unpaid_invoices, item_adjust_unpaid_invoices, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/killbill_client/models/account.rb', line 97
def close(cancel_subscriptions, writeoff_unpaid_invoices, item_adjust_unpaid_invoices, user = nil, reason = nil, = nil, options = {})
created_account = self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
{},
{
:cancelAllSubscriptions => cancel_subscriptions,
:writeOffUnpaidInvoices => writeoff_unpaid_invoices,
:itemAdjustUnpaidInvoices => item_adjust_unpaid_invoices
},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_account.refresh(options)
end
|
#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/killbill_client/models/account.rb', line 68
def create(user = nil, reason = nil, = nil, options = {})
created_account = self.class.post KILLBILL_API_ACCOUNTS_PREFIX,
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
created_account.refresh(options)
end
|
#emails(audit = 'NONE', options = {}) ⇒ Object
259
260
261
262
263
264
265
266
|
# File 'lib/killbill_client/models/account.rb', line 259
def emails(audit = 'NONE', options = {})
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails",
{
:audit => audit
},
options,
AccountEmailAttributes
end
|
#invoices(with_items = false, options = {}) ⇒ Object
134
135
136
137
138
139
140
141
|
# File 'lib/killbill_client/models/account.rb', line 134
def invoices(with_items=false, options = {})
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices",
{
:withItems => with_items
},
options,
Invoice
end
|
#manual_pay?(options = {}) ⇒ Boolean
209
210
211
|
# File 'lib/killbill_client/models/account.rb', line 209
def manual_pay?(options = {})
control_tag?(MANUAL_PAY_ID, options)
end
|
#overdue(options = {}) ⇒ Object
#overdue_enforcement_off?(options = {}) ⇒ Boolean
185
186
187
|
# File 'lib/killbill_client/models/account.rb', line 185
def overdue_enforcement_off?(options = {})
control_tag?(OVERDUE_ENFORCEMENT_OFF_ID, options)
end
|
#payments(options = {}) ⇒ Object
143
144
145
146
147
148
|
# File 'lib/killbill_client/models/account.rb', line 143
def payments(options = {})
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments",
{},
options,
Payment
end
|
#remove_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
181
182
183
|
# File 'lib/killbill_client/models/account.rb', line 181
def remove_auto_invoicing_off(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(AUTO_INVOICING_OFF_ID, user, reason, , options)
end
|
#remove_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
169
170
171
|
# File 'lib/killbill_client/models/account.rb', line 169
def remove_auto_pay_off(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(AUTO_PAY_OFF_ID, user, reason, , options)
end
|
#remove_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
248
249
250
251
252
253
254
255
256
257
|
# File 'lib/killbill_client/models/account.rb', line 248
def remove_email(email, user = nil, reason = nil, = nil, options = {})
self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails/#{email}",
{},
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#remove_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
217
218
219
|
# File 'lib/killbill_client/models/account.rb', line 217
def remove_manual_pay(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(MANUAL_PAY_ID, user, reason, , options)
end
|
#remove_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
193
194
195
|
# File 'lib/killbill_client/models/account.rb', line 193
def remove_overdue_enforcement_off(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(OVERDUE_ENFORCEMENT_OFF_ID, user, reason, , options)
end
|
#remove_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
229
230
231
|
# File 'lib/killbill_client/models/account.rb', line 229
def remove_test(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(TEST_ID, user, reason, , options)
end
|
#remove_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
205
206
207
|
# File 'lib/killbill_client/models/account.rb', line 205
def remove_written_off(user = nil, reason = nil, = nil, options = {})
remove_tag_from_definition_id(WRITTEN_OFF_ID, user, reason, , options)
end
|
#set_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
177
178
179
|
# File 'lib/killbill_client/models/account.rb', line 177
def set_auto_invoicing_off(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(AUTO_INVOICING_OFF_ID, user, reason, , options)
end
|
#set_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
165
166
167
|
# File 'lib/killbill_client/models/account.rb', line 165
def set_auto_pay_off(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(AUTO_PAY_OFF_ID, user, reason, , options)
end
|
#set_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
213
214
215
|
# File 'lib/killbill_client/models/account.rb', line 213
def set_manual_pay(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(MANUAL_PAY_ID, user, reason, , options)
end
|
#set_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
189
190
191
|
# File 'lib/killbill_client/models/account.rb', line 189
def set_overdue_enforcement_off(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(OVERDUE_ENFORCEMENT_OFF_ID, user, reason, , options)
end
|
#set_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
225
226
227
|
# File 'lib/killbill_client/models/account.rb', line 225
def set_test(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(TEST_ID, user, reason, , options)
end
|
#set_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
201
202
203
|
# File 'lib/killbill_client/models/account.rb', line 201
def set_written_off(user = nil, reason = nil, = nil, options = {})
add_tag_from_definition_id(WRITTEN_OFF_ID, user, reason, , options)
end
|
#test?(options = {}) ⇒ Boolean
221
222
223
|
# File 'lib/killbill_client/models/account.rb', line 221
def test?(options = {})
control_tag?(TEST_ID, options)
end
|
#transfer_child_credit(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/killbill_client/models/account.rb', line 115
def transfer_child_credit(user = nil, reason = nil, = nil, options = {})
self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/transferCredit",
{},
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#update(treat_null_as_reset = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/killbill_client/models/account.rb', line 80
def update(treat_null_as_reset = false, user = nil, reason = nil, = nil, options = {})
params = {}
params[:treatNullAsReset] = treat_null_as_reset
updated_account = self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
to_json,
params,
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
updated_account.refresh(options)
end
|
#update_email_notifications(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
268
269
270
271
272
273
274
275
276
277
|
# File 'lib/killbill_client/models/account.rb', line 268
def update_email_notifications(user = nil, reason = nil, = nil, options = {})
self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications",
to_json,
{},
{
:user => user,
:reason => reason,
:comment => ,
}.merge(options)
end
|
#written_off?(options = {}) ⇒ Boolean
197
198
199
|
# File 'lib/killbill_client/models/account.rb', line 197
def written_off?(options = {})
control_tag?(WRITTEN_OFF_ID, options)
end
|