Class: KillBillClient::Model::Account
- Inherits:
-
AccountAttributes
- Object
- Resource
- AccountAttributes
- KillBillClient::Model::Account
- Includes:
- AuditLogWithHistoryHelper, CustomFieldHelper, TagHelper
- Defined in:
- lib/killbill_client/models/account.rb
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
- #audit(options = {}) ⇒ Object
- #auto_invoicing_off?(options = {}) ⇒ Boolean
- #auto_pay_off?(options = {}) ⇒ Boolean
- #blocking_states(blocking_state_types, blocking_state_svcs, audit = 'NONE', options = {}) ⇒ Object
- #bundles(options = {}) ⇒ Object
- #cba_rebalancing(user = nil, reason = nil, comment = nil, 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
- #email_audit_logs_with_history(account_email_id, options = {}) ⇒ Object
- #email_notifications(options = {}) ⇒ Object
- #emails(audit = 'NONE', options = {}) ⇒ Object
- #invoice_payments(audit = 'NONE', with_plugin_info = false, with_attempts = false, options = {}) ⇒ Object
- #invoices(with_items = false, options = {}) ⇒ Object
- #manual_pay?(options = {}) ⇒ Boolean
- #migration_invoices(with_items = false, options = {}) ⇒ Object
- #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_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, 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
Methods included from AuditLogWithHistoryHelper
Methods included from CustomFieldHelper
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
38 39 40 41 42 43 44 45 46 |
# File 'lib/killbill_client/models/account.rb', line 38 def find_by_external_key(external_key, with_balance = false, with_balance_and_cba = false, = {}) get "#{KILLBILL_API_ACCOUNTS_PREFIX}", { :externalKey => external_key, :accountWithBalance => with_balance, :accountWithBalanceAndCBA => with_balance_and_cba }, end |
.find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/killbill_client/models/account.rb', line 29 def find_by_id(account_id, with_balance = false, with_balance_and_cba = false, = {}) get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}", { :accountWithBalance => with_balance, :accountWithBalanceAndCBA => with_balance_and_cba }, end |
.find_children(account_id, with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/killbill_client/models/account.rb', line 59 def find_children(account_id, with_balance = false, with_balance_and_cba = false, audit='NONE', = {}) get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/children", { :audit => audit, :accountWithBalance => with_balance, :accountWithBalanceAndCBA => with_balance_and_cba }, end |
.find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/killbill_client/models/account.rb', line 18 def find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, = {}) get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}", { :offset => offset, :limit => limit, :accountWithBalance => with_balance, :accountWithBalanceAndCBA => with_balance_and_cba }, end |
.find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/killbill_client/models/account.rb', line 48 def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, = {}) get "#{KILLBILL_API_ACCOUNTS_PREFIX}/search/#{search_key}", { :offset => offset, :limit => limit, :accountWithBalance => with_balance, :accountWithBalanceAndCBA => with_balance_and_cba }, end |
Instance Method Details
#add_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/killbill_client/models/account.rb', line 245 def add_email(email, user = nil, reason = nil, comment = nil, = {}) self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails", { # TODO Required ATM :accountId => account_id, :email => email }.to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#all_custom_fields(object_type, audit = 'NONE', options = {}) ⇒ Object
317 318 319 320 321 322 323 324 325 |
# File 'lib/killbill_client/models/account.rb', line 317 def all_custom_fields(object_type, audit = 'NONE', = {}) params = {} params[:objectType] = object_type if object_type params[:audit] = audit self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/allCustomFields", params, , CustomField end |
#all_tags(object_type, included_deleted, audit = 'NONE', options = {}) ⇒ Object
305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/killbill_client/models/account.rb', line 305 def (object_type, included_deleted, audit = 'NONE', = {}) 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, , Tag end |
#audit(options = {}) ⇒ Object
384 385 386 387 388 389 |
# File 'lib/killbill_client/models/account.rb', line 384 def audit( = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/auditLogs", {}, , AuditLog end |
#auto_invoicing_off?(options = {}) ⇒ Boolean
185 186 187 |
# File 'lib/killbill_client/models/account.rb', line 185 def auto_invoicing_off?( = {}) control_tag?(AUTO_INVOICING_OFF_ID, ) end |
#auto_pay_off?(options = {}) ⇒ Boolean
173 174 175 |
# File 'lib/killbill_client/models/account.rb', line 173 def auto_pay_off?( = {}) control_tag?(AUTO_PAY_OFF_ID, ) end |
#blocking_states(blocking_state_types, blocking_state_svcs, audit = 'NONE', options = {}) ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/killbill_client/models/account.rb', line 327 def blocking_states(blocking_state_types, blocking_state_svcs, audit = 'NONE', = {}) params = {} params[:blockingStateTypes] = blocking_state_types if blocking_state_types params[:blockingStateSvcs] = blocking_state_svcs if blocking_state_svcs params[:audit] = audit self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/block", params, , BlockingStateAttributes end |
#bundles(options = {}) ⇒ Object
129 130 131 132 133 134 |
# File 'lib/killbill_client/models/account.rb', line 129 def bundles( = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/bundles", {}, , Bundle end |
#cba_rebalancing(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
362 363 364 365 366 367 368 369 370 371 |
# File 'lib/killbill_client/models/account.rb', line 362 def cba_rebalancing(user = nil, reason = nil, comment = nil, = {}) self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/cbaRebalancing", {}, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#children(with_balance = false, with_balance_and_cba = false, audit = 'NONE', options = {}) ⇒ Object
169 170 171 |
# File 'lib/killbill_client/models/account.rb', line 169 def children(with_balance = false, with_balance_and_cba = false, audit='NONE', = {}) Account::find_children(self.account_id, with_balance, with_balance_and_cba, audit, ) end |
#close(cancel_subscriptions, writeoff_unpaid_invoices, item_adjust_unpaid_invoices, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/killbill_client/models/account.rb', line 99 def close(cancel_subscriptions, writeoff_unpaid_invoices, item_adjust_unpaid_invoices, user = nil, reason = nil, comment = nil, = {}) 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 => comment, }.merge() created_account.refresh() end |
#create(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/killbill_client/models/account.rb', line 70 def create(user = nil, reason = nil, comment = nil, = {}) created_account = self.class.post KILLBILL_API_ACCOUNTS_PREFIX, to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() created_account.refresh() end |
#email_audit_logs_with_history(account_email_id, options = {}) ⇒ Object
280 281 282 283 284 285 |
# File 'lib/killbill_client/models/account.rb', line 280 def email_audit_logs_with_history(account_email_id, = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails/#{account_email_id}/auditLogsWithHistory", {}, , AuditLog end |
#email_notifications(options = {}) ⇒ Object
287 288 289 290 291 292 |
# File 'lib/killbill_client/models/account.rb', line 287 def email_notifications( = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications", {}, , InvoiceEmailAttributes end |
#emails(audit = 'NONE', options = {}) ⇒ Object
271 272 273 274 275 276 277 278 |
# File 'lib/killbill_client/models/account.rb', line 271 def emails(audit = 'NONE', = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails", { :audit => audit }, , AccountEmailAttributes end |
#invoice_payments(audit = 'NONE', with_plugin_info = false, with_attempts = false, options = {}) ⇒ Object
373 374 375 376 377 378 379 380 381 382 |
# File 'lib/killbill_client/models/account.rb', line 373 def invoice_payments(audit='NONE', with_plugin_info = false, with_attempts = false, = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoicePayments", { :audit => audit, :withPluginInfo => with_plugin_info, :withAttempts => with_attempts }, , InvoicePayment end |
#invoices(with_items = false, options = {}) ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/killbill_client/models/account.rb', line 136 def invoices(with_items=false, = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices", { :withItems => with_items }, , Invoice end |
#manual_pay?(options = {}) ⇒ Boolean
221 222 223 |
# File 'lib/killbill_client/models/account.rb', line 221 def manual_pay?( = {}) control_tag?(MANUAL_PAY_ID, ) end |
#migration_invoices(with_items = false, options = {}) ⇒ Object
145 146 147 148 149 150 151 152 153 |
# File 'lib/killbill_client/models/account.rb', line 145 def migration_invoices(with_items=false, = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices", { :withMigrationInvoices => true, :withItems => with_items }, , Invoice end |
#overdue(options = {}) ⇒ Object
162 163 164 165 166 167 |
# File 'lib/killbill_client/models/account.rb', line 162 def overdue( = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/overdue", {}, , OverdueStateAttributes end |
#overdue_enforcement_off?(options = {}) ⇒ Boolean
197 198 199 |
# File 'lib/killbill_client/models/account.rb', line 197 def overdue_enforcement_off?( = {}) control_tag?(OVERDUE_ENFORCEMENT_OFF_ID, ) end |
#payments(options = {}) ⇒ Object
155 156 157 158 159 160 |
# File 'lib/killbill_client/models/account.rb', line 155 def payments( = {}) self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments", {}, , Payment end |
#remove_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
193 194 195 |
# File 'lib/killbill_client/models/account.rb', line 193 def remove_auto_invoicing_off(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(AUTO_INVOICING_OFF_ID, user, reason, comment, ) end |
#remove_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
181 182 183 |
# File 'lib/killbill_client/models/account.rb', line 181 def remove_auto_pay_off(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(AUTO_PAY_OFF_ID, user, reason, comment, ) end |
#remove_email(email, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
260 261 262 263 264 265 266 267 268 269 |
# File 'lib/killbill_client/models/account.rb', line 260 def remove_email(email, user = nil, reason = nil, comment = nil, = {}) self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails/#{email}", {}, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#remove_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
229 230 231 |
# File 'lib/killbill_client/models/account.rb', line 229 def remove_manual_pay(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(MANUAL_PAY_ID, user, reason, comment, ) end |
#remove_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
205 206 207 |
# File 'lib/killbill_client/models/account.rb', line 205 def remove_overdue_enforcement_off(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(OVERDUE_ENFORCEMENT_OFF_ID, user, reason, comment, ) end |
#remove_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
241 242 243 |
# File 'lib/killbill_client/models/account.rb', line 241 def remove_test(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(TEST_ID, user, reason, comment, ) end |
#remove_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
217 218 219 |
# File 'lib/killbill_client/models/account.rb', line 217 def remove_written_off(user = nil, reason = nil, comment = nil, = {}) remove_tag_from_definition_id(WRITTEN_OFF_ID, user, reason, comment, ) end |
#set_auto_invoicing_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
189 190 191 |
# File 'lib/killbill_client/models/account.rb', line 189 def set_auto_invoicing_off(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(AUTO_INVOICING_OFF_ID, user, reason, comment, ) end |
#set_auto_pay_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
177 178 179 |
# File 'lib/killbill_client/models/account.rb', line 177 def set_auto_pay_off(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(AUTO_PAY_OFF_ID, user, reason, comment, ) end |
#set_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/killbill_client/models/account.rb', line 339 def set_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, = {}) params = {} params[:requestedDate] = requested_date if requested_date body = KillBillClient::Model::BlockingStateAttributes.new body.state_name = state_name body.service = service body.block_change = block_change body.block_entitlement = block_entitlement body.block_billing = block_billing self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/block", body.to_json, params, { :user => user, :reason => reason, :comment => comment, }.merge() blocking_states(nil, nil, 'NONE', ) end |
#set_manual_pay(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
225 226 227 |
# File 'lib/killbill_client/models/account.rb', line 225 def set_manual_pay(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(MANUAL_PAY_ID, user, reason, comment, ) end |
#set_overdue_enforcement_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
201 202 203 |
# File 'lib/killbill_client/models/account.rb', line 201 def set_overdue_enforcement_off(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(OVERDUE_ENFORCEMENT_OFF_ID, user, reason, comment, ) end |
#set_test(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
237 238 239 |
# File 'lib/killbill_client/models/account.rb', line 237 def set_test(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(TEST_ID, user, reason, comment, ) end |
#set_written_off(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
213 214 215 |
# File 'lib/killbill_client/models/account.rb', line 213 def set_written_off(user = nil, reason = nil, comment = nil, = {}) add_tag_from_definition_id(WRITTEN_OFF_ID, user, reason, comment, ) end |
#test?(options = {}) ⇒ Boolean
233 234 235 |
# File 'lib/killbill_client/models/account.rb', line 233 def test?( = {}) control_tag?(TEST_ID, ) end |
#transfer_child_credit(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/killbill_client/models/account.rb', line 117 def transfer_child_credit(user = nil, reason = nil, comment = nil, = {}) self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/transferCredit", {}, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#update(treat_null_as_reset = false, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/killbill_client/models/account.rb', line 82 def update(treat_null_as_reset = false, user = nil, reason = nil, comment = nil, = {}) 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 => comment, }.merge() updated_account.refresh() end |
#update_email_notifications(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
294 295 296 297 298 299 300 301 302 303 |
# File 'lib/killbill_client/models/account.rb', line 294 def update_email_notifications(user = nil, reason = nil, comment = nil, = {}) self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#written_off?(options = {}) ⇒ Boolean
209 210 211 |
# File 'lib/killbill_client/models/account.rb', line 209 def written_off?( = {}) control_tag?(WRITTEN_OFF_ID, ) end |