class Bfwd::APIQuote
Entity containing a price quote.
Attributes
{"description":"ID of the account for which a price quote is requested.","verbs":}
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
{"description":"A list of coupon codes to consider in calculating the quote.","verbs":}
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
{"description":"The currency of any quoted prices — as specified by a three-character ISO 4217 currency code (i.e. USD).","verbs":}
{"description":"Total amount deducted from price via discounts — includes any tax upon the discounts themselves.","verbs":}
{"description":"Total amount deducted from price via discounts — excludes any tax upon the discounts themselves.","verbs":}
{"description":"A list of discounts applied in calculating the quote.","verbs":}
{"description":"ID of the organization in whose name the quote was generated.","verbs":}
{"default":"(End of period described in `periodStart`)","description":"The end date-time of the interval for which a price quote is requested.","verbs":}
{"default":"(Time at which quote is requested)","description":"The start date-time of the interval for which a price quote is requested.","verbs":}
{"description":"ID of the product for which a price quote is requested.","verbs":}
{"description":"Name of the product for which a price quote is requested.","verbs":}
{"description":"ID of the rate plan (of some product) for which a price quote is requested.","verbs":}
{"description":"Name of the rate plan (of some product) for which a price quote is requested.","verbs":}
{"default":true,"description":"Whether consumption for fractions/multiples of periods is calculated as a fraction/multiple of the cost of consumption for a whole period.","verbs":}
{"description":"Public name of the product for which a price quote is requested.","verbs":}
{"description":"Public name of the rate plan (of some product) for which a price quote is requested.","verbs":}
{"description":"A list of calculated prices for each pricing component described in the quote request.","verbs":}
{"default":"RecurringPeriod","description":"Subscription scenario with which the quote is concerned.","verbs":}
{"description":"If migration quote whether or not the rate plans have the same duration","verbs":}
{"description":"ID of the subscription for which a price quote is requested.","verbs":}
{"description":"The cost — including tax, but excluding discounts — of all items described in the quote.","verbs":}
{"description":"The cost — excluding tax, and excluding discounts — of all items described in the quote.","verbs":}
{"description":"The portion of this quote's cost which is comprised of tax.","verbs":}
{"description":"The cost — including tax, and with discounts (themselves including tax) applied — of all items described in the quote.","verbs":}
{"description":"The cost — excluding tax, and with discounts (themselves excluding tax) applied — of all items described in the quote.","verbs":}
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/bf_ruby2/models/api_quote.rb, line 128 def self.attribute_map { :'created' => :'created', :'changed_by' => :'changedBy', :'subtotal' => :'subtotal', :'subtotal_excluding_tax' => :'subtotalExcludingTax', :'total' => :'total', :'total_excluding_tax' => :'totalExcludingTax', :'tax' => :'tax', :'discount' => :'discount', :'discount_excluding_tax' => :'discountExcludingTax', :'currency' => :'currency', :'product_name' => :'productName', :'public_product_name' => :'publicProductName', :'product_rate_plan_name' => :'productRatePlanName', :'public_product_rate_plan_name' => :'publicProductRatePlanName', :'product_id' => :'productID', :'product_rate_plan_id' => :'productRatePlanID', :'subscription_id' => :'subscriptionID', :'account_id' => :'accountID', :'quantities' => :'quantities', :'discounts' => :'discounts', :'quote_for' => :'quoteFor', :'period_start' => :'periodStart', :'period_end' => :'periodEnd', :'total_periods' => :'totalPeriods', :'proration_enabled' => :'prorationEnabled', :'uplift' => :'uplift', :'coupon_codes' => :'couponCodes', :'organization_id' => :'organizationID', :'same_product_period' => :'sameProductPeriod' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/bf_ruby2/models/api_quote.rb, line 199 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?(:'created') self.created = attributes[:'created'] end if attributes.has_key?(:'changedBy') self.changed_by = attributes[:'changedBy'] end if attributes.has_key?(:'subtotal') self.subtotal = attributes[:'subtotal'] end if attributes.has_key?(:'subtotalExcludingTax') self.subtotal_excluding_tax = attributes[:'subtotalExcludingTax'] end if attributes.has_key?(:'total') self.total = attributes[:'total'] end if attributes.has_key?(:'totalExcludingTax') self.total_excluding_tax = attributes[:'totalExcludingTax'] 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?(:'currency') self.currency = attributes[:'currency'] end if attributes.has_key?(:'productName') self.product_name = attributes[:'productName'] end if attributes.has_key?(:'publicProductName') self.public_product_name = attributes[:'publicProductName'] end if attributes.has_key?(:'productRatePlanName') self.product_rate_plan_name = attributes[:'productRatePlanName'] end if attributes.has_key?(:'publicProductRatePlanName') self.public_product_rate_plan_name = attributes[:'publicProductRatePlanName'] end if attributes.has_key?(:'productID') self.product_id = attributes[:'productID'] end if attributes.has_key?(:'productRatePlanID') self.product_rate_plan_id = attributes[:'productRatePlanID'] end if attributes.has_key?(:'subscriptionID') self.subscription_id = attributes[:'subscriptionID'] end if attributes.has_key?(:'accountID') self.account_id = attributes[:'accountID'] end if attributes.has_key?(:'quantities') if (value = attributes[:'quantities']).is_a?(Array) self.quantities = value end end if attributes.has_key?(:'discounts') if (value = attributes[:'discounts']).is_a?(Array) self.discounts = value end end if attributes.has_key?(:'quoteFor') self.quote_for = attributes[:'quoteFor'] end if attributes.has_key?(:'periodStart') self.period_start = attributes[:'periodStart'] end if attributes.has_key?(:'periodEnd') self.period_end = attributes[:'periodEnd'] end if attributes.has_key?(:'totalPeriods') self.total_periods = attributes[:'totalPeriods'] end if attributes.has_key?(:'prorationEnabled') self.proration_enabled = attributes[:'prorationEnabled'] else self.proration_enabled = false end if attributes.has_key?(:'uplift') self.uplift = attributes[:'uplift'] end if attributes.has_key?(:'couponCodes') if (value = attributes[:'couponCodes']).is_a?(Array) self.coupon_codes = value end end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'sameProductPeriod') self.same_product_period = attributes[:'sameProductPeriod'] else self.same_product_period = false end end
Attribute type mapping.
# File lib/bf_ruby2/models/api_quote.rb, line 163 def self.swagger_types { :'created' => :'DateTime', :'changed_by' => :'String', :'subtotal' => :'Float', :'subtotal_excluding_tax' => :'Float', :'total' => :'Float', :'total_excluding_tax' => :'Float', :'tax' => :'Float', :'discount' => :'Float', :'discount_excluding_tax' => :'Float', :'currency' => :'String', :'product_name' => :'String', :'public_product_name' => :'String', :'product_rate_plan_name' => :'String', :'public_product_rate_plan_name' => :'String', :'product_id' => :'String', :'product_rate_plan_id' => :'String', :'subscription_id' => :'String', :'account_id' => :'String', :'quantities' => :'Array<APIQuoteResponseQuantity>', :'discounts' => :'Array<CouponWrapperResponse>', :'quote_for' => :'String', :'period_start' => :'DateTime', :'period_end' => :'DateTime', :'total_periods' => :'Float', :'proration_enabled' => :'BOOLEAN', :'uplift' => :'Float', :'coupon_codes' => :'Array<String>', :'organization_id' => :'String', :'same_product_period' => :'BOOLEAN' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/bf_ruby2/models/api_quote.rb, line 370 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && changed_by == o.changed_by && subtotal == o.subtotal && subtotal_excluding_tax == o.subtotal_excluding_tax && total == o.total && total_excluding_tax == o.total_excluding_tax && tax == o.tax && discount == o.discount && discount_excluding_tax == o.discount_excluding_tax && currency == o.currency && product_name == o.product_name && public_product_name == o.public_product_name && product_rate_plan_name == o.product_rate_plan_name && public_product_rate_plan_name == o.public_product_rate_plan_name && product_id == o.product_id && product_rate_plan_id == o.product_rate_plan_id && subscription_id == o.subscription_id && account_id == o.account_id && quantities == o.quantities && discounts == o.discounts && quote_for == o.quote_for && period_start == o.period_start && period_end == o.period_end && total_periods == o.total_periods && proration_enabled == o.proration_enabled && uplift == o.uplift && coupon_codes == o.coupon_codes && organization_id == o.organization_id && same_product_period == o.same_product_period end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/bf_ruby2/models/api_quote.rb, line 440 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
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/bf_ruby2/models/api_quote.rb, line 506 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
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/bf_ruby2/models/api_quote.rb, line 419 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
@see the `==` method @param [Object] Object to be compared
# File lib/bf_ruby2/models/api_quote.rb, line 406 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/bf_ruby2/models/api_quote.rb, line 412 def hash [created, changed_by, subtotal, subtotal_excluding_tax, total, total_excluding_tax, tax, discount, discount_excluding_tax, currency, product_name, public_product_name, product_rate_plan_name, public_product_rate_plan_name, product_id, product_rate_plan_id, subscription_id, account_id, quantities, discounts, quote_for, period_start, period_end, total_periods, proration_enabled, uplift, coupon_codes, organization_id, same_product_period].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/bf_ruby2/models/api_quote.rb, line 335 def list_invalid_properties invalid_properties = Array.new if @period_start.nil? invalid_properties.push("invalid value for 'period_start', period_start cannot be nil.") end if @period_end.nil? invalid_properties.push("invalid value for 'period_end', period_end cannot be nil.") end return invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] quote_for
Object to be assigned
# File lib/bf_ruby2/models/api_quote.rb, line 360 def quote_for=(quote_for) validator = EnumAttributeValidator.new('String', ["InitialPeriod", "RecurringPeriod", "Upgrade", "Migration"]) unless validator.valid?(quote_for) fail ArgumentError, "invalid value for 'quote_for', must be one of #{validator.allowable_values}." end @quote_for = quote_for end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/bf_ruby2/models/api_quote.rb, line 492 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/bf_ruby2/models/api_quote.rb, line 480 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/bf_ruby2/models/api_quote.rb, line 350 def valid? quote_for_validator = EnumAttributeValidator.new('String', ["InitialPeriod", "RecurringPeriod", "Upgrade", "Migration"]) return false unless quote_for_validator.valid?(@quote_for) return false if @period_start.nil? return false if @period_end.nil? return true end