Class: ApiReference::InvoiceLineItemParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::InvoiceLineItemParams
- Defined in:
- lib/api_reference/models/invoice_line_item_params.rb
Overview
InvoiceLineItemParams Model.
Instance Attribute Summary collapse
-
#end_date ⇒ Date
A date string to specify the line item's end date in the customer's timezone.
-
#item_id ⇒ String
The name of the line item.
-
#model_type ⇒ String
readonly
The name of the line item.
-
#name ⇒ String
The name of 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.
-
#unit_config ⇒ UnitConfig
Configuration for unit pricing.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(start_date:, end_date:, quantity:, name:, item_id:, unit_config:) ⇒ InvoiceLineItemParams
constructor
A new instance of InvoiceLineItemParams.
-
#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:, name:, item_id:, unit_config:) ⇒ InvoiceLineItemParams
Returns a new instance of InvoiceLineItemParams.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 65 def initialize(start_date:, end_date:, quantity:, name:, item_id:, unit_config:) @start_date = start_date @end_date = end_date @quantity = quantity @name = name @item_id = item_id @model_type = 'unit' @unit_config = unit_config end |
Instance Attribute Details
#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/invoice_line_item_params.rb', line 20 def end_date @end_date end |
#item_id ⇒ String
The name of the line item.
32 33 34 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 32 def item_id @item_id end |
#model_type ⇒ String (readonly)
The name of the line item.
36 37 38 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 36 def model_type @model_type end |
#name ⇒ String
The name of the line item.
28 29 30 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 28 def name @name end |
#quantity ⇒ Float
The number of units on the line item
24 25 26 |
# File 'lib/api_reference/models/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/invoice_line_item_params.rb', line 15 def start_date @start_date end |
#unit_config ⇒ UnitConfig
Configuration for unit pricing
40 41 42 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 40 def unit_config @unit_config end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 77 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 name = hash.key?('name') ? hash['name'] : nil item_id = hash.key?('item_id') ? hash['item_id'] : nil unit_config = UnitConfig.from_hash(hash['unit_config']) if hash['unit_config'] # Create object from extracted values. InvoiceLineItemParams.new(start_date: start_date, end_date: end_date, quantity: quantity, name: name, item_id: item_id, unit_config: unit_config) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['quantity'] = 'quantity' @_hash['name'] = 'name' @_hash['item_id'] = 'item_id' @_hash['model_type'] = 'model_type' @_hash['unit_config'] = 'unit_config' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 56 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 99 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.start_date, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.end_date, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.quantity, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.item_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.model_type, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.unit_config, ->(val) { UnitConfig.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['start_date'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['end_date'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['quantity'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['item_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['model_type'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['unit_config'], ->(val) { UnitConfig.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
150 151 152 153 154 155 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 150 def inspect class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\ " quantity: #{@quantity.inspect}, name: #{@name.inspect}, item_id: #{@item_id.inspect},"\ " model_type: #{@model_type.inspect}, unit_config: #{@unit_config.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
142 143 144 145 146 147 |
# File 'lib/api_reference/models/invoice_line_item_params.rb', line 142 def to_s class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, quantity: #{@quantity},"\ " name: #{@name}, item_id: #{@item_id}, model_type: #{@model_type}, unit_config:"\ " #{@unit_config}>" end |