Class: ApiReference::CreateInvoiceLineItemParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CreateInvoiceLineItemParams
- Defined in:
- lib/api_reference/models/create_invoice_line_item_params.rb
Overview
CreateInvoiceLineItemParams Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
The total amount in the invoice's currency to add to the line item.
-
#end_date ⇒ Date
A date string to specify the line item's end date in the customer's timezone.
-
#invoice_id ⇒ String
The id of the Invoice to add this line item.
-
#item_id ⇒ String
The id of the item to associate with this line item.
-
#name ⇒ String
The name to use for the line item.
-
#quantity ⇒ Float
The number of units on the line item.
-
#start_date ⇒ Date
A date string to specify the line item's start date in the customer's timezone.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(start_date:, end_date:, quantity:, invoice_id:, amount:, name: SKIP, item_id: SKIP) ⇒ CreateInvoiceLineItemParams
constructor
A new instance of CreateInvoiceLineItemParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(start_date:, end_date:, quantity:, invoice_id:, amount:, name: SKIP, item_id: SKIP) ⇒ CreateInvoiceLineItemParams
Returns a new instance of CreateInvoiceLineItemParams.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 79 def initialize(start_date:, end_date:, quantity:, invoice_id:, amount:, name: SKIP, item_id: SKIP) @start_date = start_date @end_date = end_date @quantity = quantity @invoice_id = invoice_id @name = name unless name == SKIP @amount = amount @item_id = item_id unless item_id == SKIP end |
Instance Attribute Details
#amount ⇒ String
The total amount in the invoice's currency to add to the line item.
41 42 43 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 41 def amount @amount end |
#end_date ⇒ Date
A date string to specify the line item's end date in the customer's timezone.
20 21 22 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 20 def end_date @end_date end |
#invoice_id ⇒ String
The id of the Invoice to add this line item.
28 29 30 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 28 def invoice_id @invoice_id end |
#item_id ⇒ String
The id of the item to associate with this line item. If provided without
name, the item's name will be used for the price/line item. If provided
with name, the item will be associated but name will be used for the
line item. At least one of name or item_id must be provided.
48 49 50 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 48 def item_id @item_id end |
#name ⇒ String
The name to use for the line item. If item_id is not provided, Orb will
search for an item with this name. If found, that item will be associated
with the line item. If not found, a new item will be created with this
name. If item_id is provided, this name will be used for the line item,
but the item association will be based on item_id. At least one of
name or item_id must be provided.
37 38 39 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 37 def name @name end |
#quantity ⇒ Float
The number of units on the line item
24 25 26 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 24 def quantity @quantity end |
#start_date ⇒ Date
A date string to specify the line item's start date in the customer's timezone.
15 16 17 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 15 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start_date = hash.key?('start_date') ? hash['start_date'] : nil end_date = hash.key?('end_date') ? hash['end_date'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : nil amount = hash.key?('amount') ? hash['amount'] : nil name = hash.key?('name') ? hash['name'] : SKIP item_id = hash.key?('item_id') ? hash['item_id'] : SKIP # Create object from extracted values. CreateInvoiceLineItemParams.new(start_date: start_date, end_date: end_date, quantity: quantity, invoice_id: invoice_id, amount: amount, name: name, item_id: item_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['quantity'] = 'quantity' @_hash['invoice_id'] = 'invoice_id' @_hash['name'] = 'name' @_hash['amount'] = 'amount' @_hash['item_id'] = 'item_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
72 73 74 75 76 77 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 72 def self.nullables %w[ name item_id ] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 64 def self.optionals %w[ name item_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
121 122 123 124 125 126 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 121 def inspect class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\ " quantity: #{@quantity.inspect}, invoice_id: #{@invoice_id.inspect}, name:"\ " #{@name.inspect}, amount: #{@amount.inspect}, item_id: #{@item_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
114 115 116 117 118 |
# File 'lib/api_reference/models/create_invoice_line_item_params.rb', line 114 def to_s class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, quantity: #{@quantity},"\ " invoice_id: #{@invoice_id}, name: #{@name}, amount: #{@amount}, item_id: #{@item_id}>" end |