Class: NewStoreApi::BookingProduct
- Defined in:
- lib/new_store_api/models/booking_product.rb
Overview
BookingProduct Model.
Instance Attribute Summary collapse
-
#currency ⇒ CurrencyEnum
TODO: Write general description for this method.
-
#customs_info ⇒ BookingProductCustoms
TODO: Write general description for this method.
-
#dimension_height ⇒ Float
TODO: Write general description for this method.
-
#dimension_length ⇒ Float
TODO: Write general description for this method.
-
#dimension_unit ⇒ String
TODO: Write general description for this method.
-
#dimension_width ⇒ Float
TODO: Write general description for this method.
-
#external_identifiers ⇒ Hash[String, Object]
TODO: Write general description for this method.
-
#id ⇒ String
It should be the NewStore imported catalog ID.
-
#price ⇒ Float
It should be the NewStore imported catalog ID.
-
#quantity ⇒ Integer
It should be the NewStore imported catalog ID.
-
#weight ⇒ Float
It should be the NewStore imported catalog ID.
-
#weight_unit ⇒ String
It should be the NewStore imported catalog ID.
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(id = nil, quantity = nil, currency = SKIP, customs_info = SKIP, dimension_height = SKIP, dimension_length = SKIP, dimension_unit = SKIP, dimension_width = SKIP, external_identifiers = SKIP, price = SKIP, weight = SKIP, weight_unit = SKIP) ⇒ BookingProduct
constructor
A new instance of BookingProduct.
-
#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(id = nil, quantity = nil, currency = SKIP, customs_info = SKIP, dimension_height = SKIP, dimension_length = SKIP, dimension_unit = SKIP, dimension_width = SKIP, external_identifiers = SKIP, price = SKIP, weight = SKIP, weight_unit = SKIP) ⇒ BookingProduct
Returns a new instance of BookingProduct.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/new_store_api/models/booking_product.rb', line 110 def initialize(id = nil, quantity = nil, currency = SKIP, customs_info = SKIP, dimension_height = SKIP, dimension_length = SKIP, dimension_unit = SKIP, dimension_width = SKIP, external_identifiers = SKIP, price = SKIP, weight = SKIP, weight_unit = SKIP) @currency = currency unless currency == SKIP @customs_info = customs_info unless customs_info == SKIP @dimension_height = dimension_height unless dimension_height == SKIP @dimension_length = dimension_length unless dimension_length == SKIP @dimension_unit = dimension_unit unless dimension_unit == SKIP @dimension_width = dimension_width unless dimension_width == SKIP @external_identifiers = external_identifiers unless external_identifiers == SKIP @id = id @price = price unless price == SKIP @quantity = quantity @weight = weight unless weight == SKIP @weight_unit = weight_unit unless weight_unit == SKIP end |
Instance Attribute Details
#currency ⇒ CurrencyEnum
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/booking_product.rb', line 14 def currency @currency end |
#customs_info ⇒ BookingProductCustoms
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/booking_product.rb', line 18 def customs_info @customs_info end |
#dimension_height ⇒ Float
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/booking_product.rb', line 22 def dimension_height @dimension_height end |
#dimension_length ⇒ Float
TODO: Write general description for this method
26 27 28 |
# File 'lib/new_store_api/models/booking_product.rb', line 26 def dimension_length @dimension_length end |
#dimension_unit ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/new_store_api/models/booking_product.rb', line 30 def dimension_unit @dimension_unit end |
#dimension_width ⇒ Float
TODO: Write general description for this method
34 35 36 |
# File 'lib/new_store_api/models/booking_product.rb', line 34 def dimension_width @dimension_width end |
#external_identifiers ⇒ Hash[String, Object]
TODO: Write general description for this method
38 39 40 |
# File 'lib/new_store_api/models/booking_product.rb', line 38 def external_identifiers @external_identifiers end |
#id ⇒ String
It should be the NewStore imported catalog ID
42 43 44 |
# File 'lib/new_store_api/models/booking_product.rb', line 42 def id @id end |
#price ⇒ Float
It should be the NewStore imported catalog ID
46 47 48 |
# File 'lib/new_store_api/models/booking_product.rb', line 46 def price @price end |
#quantity ⇒ Integer
It should be the NewStore imported catalog ID
50 51 52 |
# File 'lib/new_store_api/models/booking_product.rb', line 50 def quantity @quantity end |
#weight ⇒ Float
It should be the NewStore imported catalog ID
54 55 56 |
# File 'lib/new_store_api/models/booking_product.rb', line 54 def weight @weight end |
#weight_unit ⇒ String
It should be the NewStore imported catalog ID
58 59 60 |
# File 'lib/new_store_api/models/booking_product.rb', line 58 def weight_unit @weight_unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/new_store_api/models/booking_product.rb', line 130 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil currency = hash.key?('currency') ? hash['currency'] : SKIP customs_info = BookingProductCustoms.from_hash(hash['customs_info']) if hash['customs_info'] dimension_height = hash.key?('dimension_height') ? hash['dimension_height'] : SKIP dimension_length = hash.key?('dimension_length') ? hash['dimension_length'] : SKIP dimension_unit = hash.key?('dimension_unit') ? hash['dimension_unit'] : SKIP dimension_width = hash.key?('dimension_width') ? hash['dimension_width'] : SKIP external_identifiers = hash.key?('external_identifiers') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:BookingProductExternalIdentifiers), hash['external_identifiers'] ) : SKIP price = hash.key?('price') ? hash['price'] : SKIP weight = hash.key?('weight') ? hash['weight'] : SKIP weight_unit = hash.key?('weight_unit') ? hash['weight_unit'] : SKIP # Create object from extracted values. BookingProduct.new(id, quantity, currency, customs_info, dimension_height, dimension_length, dimension_unit, dimension_width, external_identifiers, price, weight, weight_unit) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/new_store_api/models/booking_product.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['customs_info'] = 'customs_info' @_hash['dimension_height'] = 'dimension_height' @_hash['dimension_length'] = 'dimension_length' @_hash['dimension_unit'] = 'dimension_unit' @_hash['dimension_width'] = 'dimension_width' @_hash['external_identifiers'] = 'external_identifiers' @_hash['id'] = 'id' @_hash['price'] = 'price' @_hash['quantity'] = 'quantity' @_hash['weight'] = 'weight' @_hash['weight_unit'] = 'weight_unit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/new_store_api/models/booking_product.rb', line 95 def self.nullables %w[ currency customs_info dimension_height dimension_length dimension_unit dimension_width external_identifiers price weight weight_unit ] end |
.optionals ⇒ Object
An array for optional fields
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/new_store_api/models/booking_product.rb', line 79 def self.optionals %w[ currency customs_info dimension_height dimension_length dimension_unit dimension_width external_identifiers price weight weight_unit ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/new_store_api/models/booking_product.rb', line 170 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.quantity, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['quantity'], ->(val) { val.instance_of? Integer }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
201 202 203 204 205 206 207 208 209 |
# File 'lib/new_store_api/models/booking_product.rb', line 201 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, customs_info: #{@customs_info.inspect},"\ " dimension_height: #{@dimension_height.inspect}, dimension_length:"\ " #{@dimension_length.inspect}, dimension_unit: #{@dimension_unit.inspect}, dimension_width:"\ " #{@dimension_width.inspect}, external_identifiers: #{@external_identifiers.inspect}, id:"\ " #{@id.inspect}, price: #{@price.inspect}, quantity: #{@quantity.inspect}, weight:"\ " #{@weight.inspect}, weight_unit: #{@weight_unit.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
191 192 193 194 195 196 197 198 |
# File 'lib/new_store_api/models/booking_product.rb', line 191 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, customs_info: #{@customs_info}, dimension_height:"\ " #{@dimension_height}, dimension_length: #{@dimension_length}, dimension_unit:"\ " #{@dimension_unit}, dimension_width: #{@dimension_width}, external_identifiers:"\ " #{@external_identifiers}, id: #{@id}, price: #{@price}, quantity: #{@quantity}, weight:"\ " #{@weight}, weight_unit: #{@weight_unit}>" end |