Class: Bfwd::APIQuoteResponseQuantity
- Inherits:
-
Object
- Object
- Bfwd::APIQuoteResponseQuantity
- Defined in:
- lib/bf_ruby2/models/api_quote_response_quantity.rb
Overview
Calculated value of some pricing component for which a quote was requested.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#applies_from ⇒ Object
date-time from which the pricing component’s new value would apply.“,”verbs“:.
-
#cost ⇒ Object
cost — including tax, but excluding discounts — contributed by consumption of this pricing component.“,”verbs“:.
-
#cost_excluding_tax ⇒ Object
cost — excluding tax, and excluding discounts — contributed by consumption of this pricing component.“,”verbs“:.
-
#discount ⇒ Object
discount — including tax — applied to this pricing component.“,”verbs“:.
-
#discount_excluding_tax ⇒ Object
discount — excluding tax — applied to this pricing component.“,”verbs“:.
-
#discounts ⇒ Object
list of discounts applied in calculating the price of this pricing component.“,”verbs“:.
-
#existing_quantity ⇒ Object
quantity of the pricing component. Price is calculated with respect to a delta from this quantity.“,”verbs“:.
-
#final_cost ⇒ Object
cost — including tax, and with discounts (themselves including tax) applied — contributed by consumption of this pricing component.“,”verbs“:.
-
#final_cost_excluding_tax ⇒ Object
cost — excluding tax, and with discounts (themselves excluding tax) applied — contributed by consumption of this pricing component.“,”verbs“:.
-
#pricing_component_id ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:.
-
#pricing_component_name ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:.
-
#pricing_component_type ⇒ Object
type of the pricing component whose price was calculated.“,”verbs“:.
-
#quantity ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:.
-
#tax ⇒ Object
portion of this pricing component’s cost which is comprised of tax.“,”verbs“:.
-
#unit_of_measure ⇒ Object
‘Unit of Measure’ entity used to measure this pricing component.“,”verbs“:.
-
#unit_of_measure_display ⇒ Object
units of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:.
-
#unit_of_measure_id ⇒ Object
of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:.
-
#unit_of_measure_name ⇒ Object
of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ APIQuoteResponseQuantity
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ APIQuoteResponseQuantity
Initializes the object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 144 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'pricingComponentName') self.pricing_component_name = attributes[:'pricingComponentName'] end if attributes.has_key?(:'pricingComponentType') self.pricing_component_type = attributes[:'pricingComponentType'] end if attributes.has_key?(:'pricingComponentID') self.pricing_component_id = attributes[:'pricingComponentID'] end if attributes.has_key?(:'quantity') self.quantity = attributes[:'quantity'] end if attributes.has_key?(:'existingQuantity') self.existing_quantity = attributes[:'existingQuantity'] end if attributes.has_key?(:'finalCost') self.final_cost = attributes[:'finalCost'] end if attributes.has_key?(:'finalCostExcludingTax') self.final_cost_excluding_tax = attributes[:'finalCostExcludingTax'] end if attributes.has_key?(:'cost') self.cost = attributes[:'cost'] end if attributes.has_key?(:'costExcludingTax') self.cost_excluding_tax = attributes[:'costExcludingTax'] end if attributes.has_key?(:'tax') self.tax = attributes[:'tax'] end if attributes.has_key?(:'discount') self.discount = attributes[:'discount'] end if attributes.has_key?(:'discountExcludingTax') self.discount_excluding_tax = attributes[:'discountExcludingTax'] end if attributes.has_key?(:'unitOfMeasureID') self.unit_of_measure_id = attributes[:'unitOfMeasureID'] end if attributes.has_key?(:'unitOfMeasureName') self.unit_of_measure_name = attributes[:'unitOfMeasureName'] end if attributes.has_key?(:'unitOfMeasureDisplay') self.unit_of_measure_display = attributes[:'unitOfMeasureDisplay'] end if attributes.has_key?(:'unitOfMeasure') self.unit_of_measure = attributes[:'unitOfMeasure'] end if attributes.has_key?(:'appliesFrom') self.applies_from = attributes[:'appliesFrom'] end if attributes.has_key?(:'discounts') if (value = attributes[:'discounts']).is_a?(Array) self.discounts = value end end end |
Instance Attribute Details
#applies_from ⇒ Object
date-time from which the pricing component’s new value would apply.“,”verbs“:
67 68 69 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 67 def applies_from @applies_from end |
#cost ⇒ Object
cost — including tax, but excluding discounts — contributed by consumption of this pricing component.“,”verbs“:
40 41 42 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 40 def cost @cost end |
#cost_excluding_tax ⇒ Object
cost — excluding tax, and excluding discounts — contributed by consumption of this pricing component.“,”verbs“:
43 44 45 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 43 def cost_excluding_tax @cost_excluding_tax end |
#discount ⇒ Object
discount — including tax — applied to this pricing component.“,”verbs“:
49 50 51 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 49 def discount @discount end |
#discount_excluding_tax ⇒ Object
discount — excluding tax — applied to this pricing component.“,”verbs“:
52 53 54 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 52 def discount_excluding_tax @discount_excluding_tax end |
#discounts ⇒ Object
list of discounts applied in calculating the price of this pricing component.“,”verbs“:
70 71 72 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 70 def discounts @discounts end |
#existing_quantity ⇒ Object
quantity of the pricing component. Price is calculated with respect to a delta from this quantity.“,”verbs“:
31 32 33 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 31 def existing_quantity @existing_quantity end |
#final_cost ⇒ Object
cost — including tax, and with discounts (themselves including tax) applied — contributed by consumption of this pricing component.“,”verbs“:
34 35 36 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 34 def final_cost @final_cost end |
#final_cost_excluding_tax ⇒ Object
cost — excluding tax, and with discounts (themselves excluding tax) applied — contributed by consumption of this pricing component.“,”verbs“:
37 38 39 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 37 def final_cost_excluding_tax @final_cost_excluding_tax end |
#pricing_component_id ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
25 26 27 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 25 def pricing_component_id @pricing_component_id end |
#pricing_component_name ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
19 20 21 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 19 def pricing_component_name @pricing_component_name end |
#pricing_component_type ⇒ Object
type of the pricing component whose price was calculated.“,”verbs“:
22 23 24 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 22 def pricing_component_type @pricing_component_type end |
#quantity ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
28 29 30 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 28 def quantity @quantity end |
#tax ⇒ Object
portion of this pricing component’s cost which is comprised of tax.“,”verbs“:
46 47 48 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 46 def tax @tax end |
#unit_of_measure ⇒ Object
‘Unit of Measure’ entity used to measure this pricing component.“,”verbs“:
64 65 66 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 64 def unit_of_measure @unit_of_measure end |
#unit_of_measure_display ⇒ Object
units of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:
61 62 63 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 61 def unit_of_measure_display @unit_of_measure_display end |
#unit_of_measure_id ⇒ Object
of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:
55 56 57 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 55 def unit_of_measure_id @unit_of_measure_id end |
#unit_of_measure_name ⇒ Object
of the ‘Unit of Measure’ entity — in which this pricing component is measured.“,”verbs“:
58 59 60 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 58 def unit_of_measure_name @unit_of_measure_name end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 95 def self.attribute_map { :'pricing_component_name' => :'pricingComponentName', :'pricing_component_type' => :'pricingComponentType', :'pricing_component_id' => :'pricingComponentID', :'quantity' => :'quantity', :'existing_quantity' => :'existingQuantity', :'final_cost' => :'finalCost', :'final_cost_excluding_tax' => :'finalCostExcludingTax', :'cost' => :'cost', :'cost_excluding_tax' => :'costExcludingTax', :'tax' => :'tax', :'discount' => :'discount', :'discount_excluding_tax' => :'discountExcludingTax', :'unit_of_measure_id' => :'unitOfMeasureID', :'unit_of_measure_name' => :'unitOfMeasureName', :'unit_of_measure_display' => :'unitOfMeasureDisplay', :'unit_of_measure' => :'unitOfMeasure', :'applies_from' => :'appliesFrom', :'discounts' => :'discounts' } end |
.swagger_types ⇒ Object
Attribute type mapping.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 119 def self.swagger_types { :'pricing_component_name' => :'String', :'pricing_component_type' => :'String', :'pricing_component_id' => :'String', :'quantity' => :'Integer', :'existing_quantity' => :'Integer', :'final_cost' => :'Float', :'final_cost_excluding_tax' => :'Float', :'cost' => :'Float', :'cost_excluding_tax' => :'Float', :'tax' => :'Float', :'discount' => :'Float', :'discount_excluding_tax' => :'Float', :'unit_of_measure_id' => :'String', :'unit_of_measure_name' => :'String', :'unit_of_measure_display' => :'String', :'unit_of_measure' => :'String', :'applies_from' => :'DateTime', :'discounts' => :'Array<CouponWrapperResponse>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 253 def ==(o) return true if self.equal?(o) self.class == o.class && pricing_component_name == o.pricing_component_name && pricing_component_type == o.pricing_component_type && pricing_component_id == o.pricing_component_id && quantity == o.quantity && existing_quantity == o.existing_quantity && final_cost == o.final_cost && final_cost_excluding_tax == o.final_cost_excluding_tax && cost == o.cost && cost_excluding_tax == o.cost_excluding_tax && tax == o.tax && discount == o.discount && discount_excluding_tax == o.discount_excluding_tax && unit_of_measure_id == o.unit_of_measure_id && unit_of_measure_name == o.unit_of_measure_name && unit_of_measure_display == o.unit_of_measure_display && unit_of_measure == o.unit_of_measure && applies_from == o.applies_from && discounts == o.discounts end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 312 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Bfwd.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 378 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 291 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
278 279 280 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 278 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
284 285 286 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 284 def hash [pricing_component_name, pricing_component_type, pricing_component_id, quantity, existing_quantity, final_cost, final_cost_excluding_tax, cost, cost_excluding_tax, tax, discount, discount_excluding_tax, unit_of_measure_id, unit_of_measure_name, unit_of_measure_display, unit_of_measure, applies_from, discounts].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
228 229 230 231 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 228 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
358 359 360 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 358 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
364 365 366 367 368 369 370 371 372 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 364 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
352 353 354 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 352 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
235 236 237 238 239 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 235 def valid? pricing_component_type_validator = EnumAttributeValidator.new('String', ["setup", "subscription", "arrears", "usage"]) return false unless pricing_component_type_validator.valid?(@pricing_component_type) return true end |