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
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 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 155 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“:
78 79 80 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 78 def applies_from @applies_from end |
#cost ⇒ Object
cost — including tax, but excluding discounts — contributed by consumption of this pricing component.“,”verbs“:
51 52 53 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 51 def cost @cost end |
#cost_excluding_tax ⇒ Object
cost — excluding tax, and excluding discounts — contributed by consumption of this pricing component.“,”verbs“:
54 55 56 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 54 def cost_excluding_tax @cost_excluding_tax end |
#discount ⇒ Object
discount — including tax — applied to this pricing component.“,”verbs“:
60 61 62 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 60 def discount @discount end |
#discount_excluding_tax ⇒ Object
discount — excluding tax — applied to this pricing component.“,”verbs“:
63 64 65 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 63 def discount_excluding_tax @discount_excluding_tax end |
#discounts ⇒ Object
list of discounts applied in calculating the price of this pricing component.“,”verbs“:
81 82 83 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 81 def discounts @discounts end |
#existing_quantity ⇒ Object
quantity of the pricing component. Price is calculated with respect to a delta from this quantity.“,”verbs“:
42 43 44 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 42 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“:
45 46 47 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 45 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“:
48 49 50 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 48 def final_cost_excluding_tax @final_cost_excluding_tax end |
#pricing_component_id ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
36 37 38 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 36 def pricing_component_id @pricing_component_id end |
#pricing_component_name ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
30 31 32 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 30 def pricing_component_name @pricing_component_name end |
#pricing_component_type ⇒ Object
type of the pricing component whose price was calculated.“,”verbs“:
33 34 35 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 33 def pricing_component_type @pricing_component_type end |
#quantity ⇒ Object
of the pricing component whose price was calculated.“,”verbs“:
39 40 41 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 39 def quantity @quantity end |
#tax ⇒ Object
portion of this pricing component’s cost which is comprised of tax.“,”verbs“:
57 58 59 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 57 def tax @tax end |
#unit_of_measure ⇒ Object
‘Unit of Measure’ entity used to measure this pricing component.“,”verbs“:
75 76 77 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 75 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“:
72 73 74 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 72 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“:
66 67 68 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 66 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“:
69 70 71 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 69 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.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 106 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.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 130 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.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 264 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
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 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 323 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 =~ /^(true|t|yes|y|1)$/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
389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 389 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
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 302 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/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
289 290 291 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 289 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
295 296 297 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 295 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?
239 240 241 242 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 239 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)
369 370 371 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 369 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
375 376 377 378 379 380 381 382 383 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 375 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
363 364 365 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 363 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
246 247 248 249 250 |
# File 'lib/bf_ruby2/models/api_quote_response_quantity.rb', line 246 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 |