Class: KillBillClient::Model::Invoice
- Inherits:
-
InvoiceAttributes
- Object
- Resource
- InvoiceAttributes
- KillBillClient::Model::Invoice
- Defined in:
- lib/killbill_client/models/invoice.rb
Constant Summary collapse
- KILLBILL_API_INVOICES_PREFIX =
"#{KILLBILL_API_PREFIX}/invoices"
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_by_id_or_number(id_or_number, with_items = true, audit = "NONE", options = {}) ⇒ Object
- .trigger_invoice(account_id, target_date, dry_run, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Methods inherited from Resource
#==, #_to_hash, attribute, create_alias, delete, extract_session_id, from_json, from_response, get, has_many, has_one, #hash, head, instantiate_record_from_json, post, put, #refresh, #to_hash, #to_json
Class Method Details
.find_by_id_or_number(id_or_number, with_items = true, audit = "NONE", options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/killbill_client/models/invoice.rb', line 13 def find_by_id_or_number(id_or_number, with_items = true, audit = "NONE", = {}) get "#{KILLBILL_API_INVOICES_PREFIX}/#{id_or_number}", { :withItems => with_items, :audit => audit }, end |
.trigger_invoice(account_id, target_date, dry_run, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/killbill_client/models/invoice.rb', line 22 def trigger_invoice(account_id, target_date, dry_run, user = nil, reason = nil, comment = nil, = {}) query_map = {:accountId => account_id} query_map[:targetDate] = target_date if !target_date.nil? query_map[:dryRun] = dry_run if !dry_run.nil? begin res = post "#{KILLBILL_API_INVOICES_PREFIX}", {}, query_map, { :user => user, :reason => reason, :comment => comment, }.merge(), Invoice res.refresh() rescue KillBillClient::API::BadRequest => e # No invoice to generate : TODO parse json to verify this is indeed the case end end |