Class: KillBillClient::Model::Bundle
- Inherits:
-
BundleAttributes
- Object
- Resource
- BundleAttributes
- KillBillClient::Model::Bundle
- Includes:
- AuditLogWithHistoryHelper, CustomFieldHelper, TagHelper
- Defined in:
- lib/killbill_client/models/bundle.rb
Constant Summary collapse
- KILLBILL_API_BUNDLES_PREFIX =
"#{KILLBILL_API_PREFIX}/bundles"
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
Constants inherited from Resource
Resource::KILLBILL_API_PAGINATION_PREFIX, Resource::KILLBILL_API_PREFIX
Instance Attribute Summary
Attributes inherited from Resource
#clazz, #etag, #response, #session_id, #uri
Class Method Summary collapse
-
.find_all_by_account_id_and_external_key(account_id, external_key, options = {}) ⇒ Object
Return active and inactive ones.
-
.find_by_external_key(external_key, included_deleted, options = {}) ⇒ Object
Return the active one.
- .find_by_id(bundle_id, options = {}) ⇒ Object
- .find_in_batches(offset = 0, limit = 100, options = {}) ⇒ Object
- .find_in_batches_by_search_key(search_key, offset = 0, limit = 100, options = {}) ⇒ Object
Instance Method Summary collapse
-
#pause(requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Pause the bundle (and all its subscription).
- #rename_external_key(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
-
#resume(requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Resume the bundle (and all its subscription).
-
#set_blocking_state(state_name, service, is_block_change, is_block_entitlement, is_block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Low level api to block/unblock a given subscription/bundle/account.
-
#transfer(requested_date = nil, billing_policy = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Transfer the bundle to the new account.
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
Methods inherited from Resource
#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, #initialize, instantiate_record_from_json, post, put, #refresh, require_multi_tenant_options!, #to_hash, #to_json
Constructor Details
This class inherits a constructor from KillBillClient::Model::Resource
Class Method Details
.find_all_by_account_id_and_external_key(account_id, external_key, options = {}) ⇒ Object
Return active and inactive ones
56 57 58 59 60 |
# File 'lib/killbill_client/models/bundle.rb', line 56 def find_all_by_account_id_and_external_key(account_id, external_key, = {}) get "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/bundles?externalKey=#{external_key}", {}, end |
.find_by_external_key(external_key, included_deleted, options = {}) ⇒ Object
Return the active one
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/killbill_client/models/bundle.rb', line 44 def find_by_external_key(external_key, included_deleted, = {}) params = {} params[:externalKey] = external_key params[:includedDeleted] = included_deleted if included_deleted result = get "#{KILLBILL_API_BUNDLES_PREFIX}", params, return included_deleted ? result : result[0] end |
.find_by_id(bundle_id, options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/killbill_client/models/bundle.rb', line 37 def find_by_id(bundle_id, = {}) get "#{KILLBILL_API_BUNDLES_PREFIX}/#{bundle_id}", {}, end |
.find_in_batches(offset = 0, limit = 100, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/killbill_client/models/bundle.rb', line 19 def find_in_batches(offset = 0, limit = 100, = {}) get "#{KILLBILL_API_BUNDLES_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}", { :offset => offset, :limit => limit }, end |
.find_in_batches_by_search_key(search_key, offset = 0, limit = 100, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/killbill_client/models/bundle.rb', line 28 def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, = {}) get "#{KILLBILL_API_BUNDLES_PREFIX}/search/#{search_key}", { :offset => offset, :limit => limit }, end |
Instance Method Details
#pause(requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Pause the bundle (and all its subscription)
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/killbill_client/models/bundle.rb', line 83 def pause(requested_date = nil, user = nil, reason = nil, comment = nil, = {}) params = {} params[:requestedDate] = requested_date unless requested_date.nil? self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/pause", {}, params, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#rename_external_key(user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/killbill_client/models/bundle.rb', line 137 def rename_external_key(user = nil, reason = nil, comment = nil, = {}) self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/renameKey", to_json, {}, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#resume(requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Resume the bundle (and all its subscription)
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/killbill_client/models/bundle.rb', line 98 def resume(requested_date = nil, user = nil, reason = nil, comment = nil, = {}) params = {} params[:requestedDate] = requested_date unless requested_date.nil? self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/resume", {}, params, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#set_blocking_state(state_name, service, is_block_change, is_block_entitlement, is_block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Low level api to block/unblock a given subscription/bundle/account
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/killbill_client/models/bundle.rb', line 115 def set_blocking_state(state_name, service, is_block_change, is_block_entitlement, is_block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, = {}) params = {} params[:requestedDate] = requested_date unless requested_date.nil? body = KillBillClient::Model::BlockingStateAttributes.new body.state_name = state_name body.service = service body.is_block_change = is_block_change body.is_block_entitlement = is_block_entitlement body.is_block_billing = is_block_billing self.class.post "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/block", body.to_json, params, { :user => user, :reason => reason, :comment => comment, }.merge() end |
#transfer(requested_date = nil, billing_policy = nil, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Transfer the bundle to the new account. The new account_id should be set in this object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/killbill_client/models/bundle.rb', line 65 def transfer(requested_date = nil, billing_policy = nil, user = nil, reason = nil, comment = nil, = {}) params = {} params[:requestedDate] = requested_date unless requested_date.nil? params[:billingPolicy] = billing_policy unless billing_policy.nil? result = self.class.post "#{KILLBILL_API_BUNDLES_PREFIX}/#{bundle_id}", to_json, params, { :user => user, :reason => reason, :comment => comment, }.merge() result.refresh() end |