Class: Bfwd::PricingComponent
- Inherits:
-
Object
- Object
- Bfwd::PricingComponent
- Defined in:
- lib/bf_ruby2/models/pricing_component.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }.
-
#charge_model ⇒ Object
{ "description" : "The charge model of the pricing-component.", "verbs“: }.
-
#charge_type ⇒ Object
{ "description" : "The charge type of the pricing-component.", "verbs“: }.
-
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }.
-
#crm_id ⇒ Object
{ "description" : "", "verbs“: }.
-
#default_quantity ⇒ Object
{ "description" : "The default quantity of the pricing-component. If no value is supplied on a subscription this value will be used. This is useful for setting an expected purchase level of for introducing new pricing components to existing subscriptions and not having to back-fill values", "verbs“: }.
-
#description ⇒ Object
{ "description" : "", "verbs“: }.
-
#downgrade_mode ⇒ Object
class=\"label label-default\">delayed</span>","description":"Default behaviour when a value is downgraded using this pricing component, this behaviour can be overridden when changing the value.
<span class=\"label label-default\">immediate</span> — Downgrade will apply at the time the request is made.
<span class=\"label label-default\">delayed</span> — Downgrade will apply at the end of the current billing cycle.“,”verbs“:. -
#id ⇒ Object
{ "description" : "", "verbs“: } When associating a pricing component with a product rate plan, this ID should be used.
-
#invoicing_type ⇒ Object
{ "default" : "Aggregated", "description" : "For <span class=\"label label-default\">setup</span> pricing components <span class=\"label label-default\">Immediate</span> invoicing will result in an invoice being issued on subscription being set to the AwaitingPayment state, irrespective of the subscription start date. <span class=\"label label-default\">Aggregated</span> invoicing will add a charge to the first invoice of the subscription.", "verbs“: }.
-
#max_quantity ⇒ Object
{ "description" : "The maximum quantity of the pricing-component.", "verbs":[] }.
-
#min_quantity ⇒ Object
{ "default" : "0", "description" : "The minimum quantity of the pricing-component.", "verbs":[] }.
-
#name ⇒ Object
{ "description" : "", "verbs“: }.
-
#organization_id ⇒ Object
{ "description" : "", "verbs":[] }.
-
#product_rate_plan_id ⇒ Object
{ "description" : "", "verbs“: }.
-
#public_name ⇒ Object
friendly non-unique name used to identify this pricing-component“,”verbs“:.
-
#tiers ⇒ Object
{ "default" : "[]", "description" : "The pricing-component-tiers associated with the pricing-component.", "verbs“: }.
-
#type ⇒ Object
{ "description" : "", "default" : "", "verbs“: }.
-
#unit_of_measure ⇒ Object
{ "description" : "The unit-of-measure associated with the pricing-component.", "verbs“: }.
-
#unit_of_measure_id ⇒ Object
{ "description" : "", "verbs“: }.
-
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }.
-
#upgrade_mode ⇒ Object
class=\"label label-default\">immediate</span>","description":"Default behaviour when a value is upgraded using this pricing component, this behaviour can be overridden when changing the value.
<span class=\"label label-default\">immediate</span> — Upgrade will apply at the time the request is made.
<span class=\"label label-default\">delayed</span> — Upgrade will apply at the end of the current billing cycle.“,”verbs“:. -
#valid_from ⇒ Object
{ "default" : "current time", "description" : "The DateTime specifying when the pricing-component is valid from.", "verbs“: }.
-
#valid_till ⇒ Object
{ "default" : "null", "description" : "The UTC DateTime specifying when the pricing-component is valid till.", "verbs“: }.
-
#version_id ⇒ Object
{ "description" : "", "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 = {}) ⇒ PricingComponent
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 = {}) ⇒ PricingComponent
Initializes the object
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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 190 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?(:'updated') self.updated = attributes[:'updated'] end if attributes.has_key?(:'@type') self.type = attributes[:'@type'] end if attributes.has_key?(:'versionID') self.version_id = attributes[:'versionID'] end if attributes.has_key?(:'crmID') self.crm_id = attributes[:'crmID'] end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'productRatePlanID') self.product_rate_plan_id = attributes[:'productRatePlanID'] end if attributes.has_key?(:'unitOfMeasureID') self.unit_of_measure_id = attributes[:'unitOfMeasureID'] end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'publicName') self.public_name = attributes[:'publicName'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'chargeType') self.charge_type = attributes[:'chargeType'] end if attributes.has_key?(:'invoicingType') self.invoicing_type = attributes[:'invoicingType'] end if attributes.has_key?(:'chargeModel') self.charge_model = attributes[:'chargeModel'] end if attributes.has_key?(:'upgradeMode') self.upgrade_mode = attributes[:'upgradeMode'] end if attributes.has_key?(:'downgradeMode') self.downgrade_mode = attributes[:'downgradeMode'] end if attributes.has_key?(:'defaultQuantity') self.default_quantity = attributes[:'defaultQuantity'] end if attributes.has_key?(:'minQuantity') self.min_quantity = attributes[:'minQuantity'] end if attributes.has_key?(:'maxQuantity') self.max_quantity = attributes[:'maxQuantity'] end if attributes.has_key?(:'validFrom') self.valid_from = attributes[:'validFrom'] end if attributes.has_key?(:'validTill') self.valid_till = attributes[:'validTill'] end if attributes.has_key?(:'tiers') if (value = attributes[:'tiers']).is_a?(Array) self.tiers = value end end if attributes.has_key?(:'unitOfMeasure') self.unit_of_measure = attributes[:'unitOfMeasure'] end end |
Instance Attribute Details
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
33 34 35 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 33 def changed_by @changed_by end |
#charge_model ⇒ Object
{ "description" : "The charge model of the pricing-component.", "verbs“: }
75 76 77 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 75 def charge_model @charge_model end |
#charge_type ⇒ Object
{ "description" : "The charge type of the pricing-component.", "verbs“: }
69 70 71 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 69 def charge_type @charge_type end |
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
30 31 32 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 30 def created @created end |
#crm_id ⇒ Object
{ "description" : "", "verbs“: }
45 46 47 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 45 def crm_id @crm_id end |
#default_quantity ⇒ Object
{ "description" : "The default quantity of the pricing-component. If no value is supplied on a subscription this value will be used. This is useful for setting an expected purchase level of for introducing new pricing components to existing subscriptions and not having to back-fill values", "verbs“: }
84 85 86 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 84 def default_quantity @default_quantity end |
#description ⇒ Object
{ "description" : "", "verbs“: }
66 67 68 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 66 def description @description end |
#downgrade_mode ⇒ Object
class=\"label label-default\">delayed</span>","description":"Default behaviour when a value is downgraded using this pricing component, this behaviour can be overridden when changing the value.
<span class=\"label label-default\">immediate</span> — Downgrade will apply at the time the request is made.
<span class=\"label label-default\">delayed</span> — Downgrade will apply at the end of the current billing cycle.“,”verbs“:
81 82 83 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 81 def downgrade_mode @downgrade_mode end |
#id ⇒ Object
{ "description" : "", "verbs“: } When associating a pricing component with a product rate plan, this ID should be used.
48 49 50 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 48 def id @id end |
#invoicing_type ⇒ Object
{ "default" : "Aggregated", "description" : "For <span class=\"label label-default\">setup</span> pricing components <span class=\"label label-default\">Immediate</span> invoicing will result in an invoice being issued on subscription being set to the AwaitingPayment state, irrespective of the subscription start date. <span class=\"label label-default\">Aggregated</span> invoicing will add a charge to the first invoice of the subscription.", "verbs“: }
72 73 74 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 72 def invoicing_type @invoicing_type end |
#max_quantity ⇒ Object
{ "description" : "The maximum quantity of the pricing-component.", "verbs":[] }
90 91 92 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 90 def max_quantity @max_quantity end |
#min_quantity ⇒ Object
{ "default" : "0", "description" : "The minimum quantity of the pricing-component.", "verbs":[] }
87 88 89 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 87 def min_quantity @min_quantity end |
#name ⇒ Object
{ "description" : "", "verbs“: }
60 61 62 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 60 def name @name end |
#organization_id ⇒ Object
{ "description" : "", "verbs":[] }
57 58 59 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 57 def organization_id @organization_id end |
#product_rate_plan_id ⇒ Object
{ "description" : "", "verbs“: }
51 52 53 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 51 def product_rate_plan_id @product_rate_plan_id end |
#public_name ⇒ Object
friendly non-unique name used to identify this pricing-component“,”verbs“:
63 64 65 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 63 def public_name @public_name end |
#tiers ⇒ Object
{ "default" : "[]", "description" : "The pricing-component-tiers associated with the pricing-component.", "verbs“: }
99 100 101 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 99 def tiers @tiers end |
#type ⇒ Object
{ "description" : "", "default" : "", "verbs“: }
39 40 41 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 39 def type @type end |
#unit_of_measure ⇒ Object
{ "description" : "The unit-of-measure associated with the pricing-component.", "verbs“: }
102 103 104 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 102 def unit_of_measure @unit_of_measure end |
#unit_of_measure_id ⇒ Object
{ "description" : "", "verbs“: }
54 55 56 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 54 def unit_of_measure_id @unit_of_measure_id end |
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }
36 37 38 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 36 def updated @updated end |
#upgrade_mode ⇒ Object
class=\"label label-default\">immediate</span>","description":"Default behaviour when a value is upgraded using this pricing component, this behaviour can be overridden when changing the value.
<span class=\"label label-default\">immediate</span> — Upgrade will apply at the time the request is made.
<span class=\"label label-default\">delayed</span> — Upgrade will apply at the end of the current billing cycle.“,”verbs“:
78 79 80 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 78 def upgrade_mode @upgrade_mode end |
#valid_from ⇒ Object
{ "default" : "current time", "description" : "The DateTime specifying when the pricing-component is valid from.", "verbs“: }
93 94 95 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 93 def valid_from @valid_from end |
#valid_till ⇒ Object
{ "default" : "null", "description" : "The UTC DateTime specifying when the pricing-component is valid till.", "verbs“: }
96 97 98 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 96 def valid_till @valid_till end |
#version_id ⇒ Object
{ "description" : "", "verbs“: }
42 43 44 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 42 def version_id @version_id end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
127 128 129 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 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 127 def self.attribute_map { :'created' => :'created', :'changed_by' => :'changedBy', :'updated' => :'updated', :'type' => :'@type', :'version_id' => :'versionID', :'crm_id' => :'crmID', :'id' => :'id', :'product_rate_plan_id' => :'productRatePlanID', :'unit_of_measure_id' => :'unitOfMeasureID', :'organization_id' => :'organizationID', :'name' => :'name', :'public_name' => :'publicName', :'description' => :'description', :'charge_type' => :'chargeType', :'invoicing_type' => :'invoicingType', :'charge_model' => :'chargeModel', :'upgrade_mode' => :'upgradeMode', :'downgrade_mode' => :'downgradeMode', :'default_quantity' => :'defaultQuantity', :'min_quantity' => :'minQuantity', :'max_quantity' => :'maxQuantity', :'valid_from' => :'validFrom', :'valid_till' => :'validTill', :'tiers' => :'tiers', :'unit_of_measure' => :'unitOfMeasure' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 158 def self.swagger_types { :'created' => :'DateTime', :'changed_by' => :'String', :'updated' => :'DateTime', :'type' => :'String', :'version_id' => :'String', :'crm_id' => :'String', :'id' => :'String', :'product_rate_plan_id' => :'String', :'unit_of_measure_id' => :'String', :'organization_id' => :'String', :'name' => :'String', :'public_name' => :'String', :'description' => :'String', :'charge_type' => :'String', :'invoicing_type' => :'String', :'charge_model' => :'String', :'upgrade_mode' => :'String', :'downgrade_mode' => :'String', :'default_quantity' => :'Integer', :'min_quantity' => :'Integer', :'max_quantity' => :'Integer', :'valid_from' => :'DateTime', :'valid_till' => :'DateTime', :'tiers' => :'Array<PricingComponentTier>', :'unit_of_measure' => :'UnitOfMeasure' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 398 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && changed_by == o.changed_by && updated == o.updated && type == o.type && version_id == o.version_id && crm_id == o.crm_id && id == o.id && product_rate_plan_id == o.product_rate_plan_id && unit_of_measure_id == o.unit_of_measure_id && organization_id == o.organization_id && name == o.name && public_name == o.public_name && description == o.description && charge_type == o.charge_type && invoicing_type == o.invoicing_type && charge_model == o.charge_model && upgrade_mode == o.upgrade_mode && downgrade_mode == o.downgrade_mode && default_quantity == o.default_quantity && min_quantity == o.min_quantity && max_quantity == o.max_quantity && valid_from == o.valid_from && valid_till == o.valid_till && tiers == o.tiers && unit_of_measure == o.unit_of_measure end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 464 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
530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 530 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
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 443 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
430 431 432 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 430 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
436 437 438 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 436 def hash [created, changed_by, updated, type, version_id, crm_id, id, product_rate_plan_id, unit_of_measure_id, organization_id, name, public_name, description, charge_type, invoicing_type, charge_model, upgrade_mode, downgrade_mode, default_quantity, min_quantity, max_quantity, valid_from, valid_till, tiers, unit_of_measure].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
302 303 304 305 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 302 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)
510 511 512 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 510 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
516 517 518 519 520 521 522 523 524 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 516 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
504 505 506 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 504 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/bf_ruby2/models/pricing_component.rb', line 309 def valid? return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["tieredPricingComponent", "flatPricingComponent", "tieredVolumePricingComponent"]) return false unless type_validator.valid?(@type) return false if @version_id.nil? return false if @id.nil? return false if @product_rate_plan_id.nil? return false if @unit_of_measure_id.nil? return false if @organization_id.nil? return false if @name.nil? return false if @charge_type.nil? charge_type_validator = EnumAttributeValidator.new('String', ["setup", "subscription", "arrears", "usage"]) return false unless charge_type_validator.valid?(@charge_type) invoicing_type_validator = EnumAttributeValidator.new('String', ["Immediate", "Aggregated"]) return false unless invoicing_type_validator.valid?(@invoicing_type) return false if @charge_model.nil? charge_model_validator = EnumAttributeValidator.new('String', ["flat", "tiered", "tiered_volume"]) return false unless charge_model_validator.valid?(@charge_model) upgrade_mode_validator = EnumAttributeValidator.new('String', ["immediate", "delayed"]) return false unless upgrade_mode_validator.valid?(@upgrade_mode) downgrade_mode_validator = EnumAttributeValidator.new('String', ["immediate", "delayed"]) return false unless downgrade_mode_validator.valid?(@downgrade_mode) return false if @default_quantity.nil? return false if @valid_from.nil? return true end |