Class: TogaiClient::PricePlanV2
- Inherits:
-
Object
- Object
- TogaiClient::PricePlanV2
- Defined in:
- lib/togai_client/models/price_plan_v2.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#allow_ongoing_cycle_updates ⇒ Object
Allow changes to price plan from the beginning of the ongoing cycle.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#deferred_revenue ⇒ Object
This option can be enabled while creating a price plan to opt for deferred revenue finalization.
-
#description ⇒ Object
Description of price plan.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Name of the price plan.
-
#pricing_cycle_config ⇒ Object
Returns the value of attribute pricing_cycle_config.
-
#reference_id ⇒ Object
Returns the value of attribute reference_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#supported_currencies ⇒ Object
List of currencies supported by the price plan.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PricePlanV2
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 = {}) ⇒ PricePlanV2
Initializes the object
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 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 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 129 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::PricePlanV2` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::PricePlanV2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'pricing_cycle_config') self.pricing_cycle_config = attributes[:'pricing_cycle_config'] end if attributes.key?(:'supported_currencies') if (value = attributes[:'supported_currencies']).is_a?(Array) self.supported_currencies = value end else self.supported_currencies = nil end if attributes.key?(:'deferred_revenue') self.deferred_revenue = attributes[:'deferred_revenue'] end if attributes.key?(:'allow_ongoing_cycle_updates') self.allow_ongoing_cycle_updates = attributes[:'allow_ongoing_cycle_updates'] end if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'reference_id') self.reference_id = attributes[:'reference_id'] else self.reference_id = nil end if attributes.key?(:'version') self.version = attributes[:'version'] else self.version = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] else self.updated_at = nil end end |
Instance Attribute Details
#allow_ongoing_cycle_updates ⇒ Object
Allow changes to price plan from the beginning of the ongoing cycle.
35 36 37 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 35 def allow_ongoing_cycle_updates @allow_ongoing_cycle_updates end |
#created_at ⇒ Object
Returns the value of attribute created_at.
45 46 47 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 45 def created_at @created_at end |
#deferred_revenue ⇒ Object
This option can be enabled while creating a price plan to opt for deferred revenue finalization. i.e, Togai will assume that the price plan may change any time during the pricing cycle and thereby does not compute the revenue in near-real time. This gives the flexibility of editing rate cards in price plan from beginning of the pricing cycle. Enabling this mode comes with the following limitations. 1. Following rate cards are not supported under a ‘deferredRevenue` plan * creditGrantRateCards, * billingEntitlementRateCards, * entitlementOverageRateCards, * IN_ADVANCE fixedFeeRateCards, * IN_ADVANCE licenseRateCards 2. Metrics API return revenue metrics only after the grace period of the account’s pricing cycle (i.e, only once the invoice becomes DUE)
32 33 34 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 32 def deferred_revenue @deferred_revenue end |
#description ⇒ Object
Description of price plan
22 23 24 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 22 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
37 38 39 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 37 def id @id end |
#name ⇒ Object
Name of the price plan
19 20 21 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 19 def name @name end |
#pricing_cycle_config ⇒ Object
Returns the value of attribute pricing_cycle_config.
26 27 28 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 26 def pricing_cycle_config @pricing_cycle_config end |
#reference_id ⇒ Object
Returns the value of attribute reference_id.
39 40 41 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 39 def reference_id @reference_id end |
#status ⇒ Object
Returns the value of attribute status.
43 44 45 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 43 def status @status end |
#supported_currencies ⇒ Object
List of currencies supported by the price plan
29 30 31 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 29 def supported_currencies @supported_currencies end |
#type ⇒ Object
Returns the value of attribute type.
24 25 26 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 24 def type @type end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
47 48 49 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 47 def updated_at @updated_at end |
#version ⇒ Object
Returns the value of attribute version.
41 42 43 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 41 def version @version end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 432 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = TogaiClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
91 92 93 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 91 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 72 def self.attribute_map { :'name' => :'name', :'description' => :'description', :'type' => :'type', :'pricing_cycle_config' => :'pricingCycleConfig', :'supported_currencies' => :'supportedCurrencies', :'deferred_revenue' => :'deferredRevenue', :'allow_ongoing_cycle_updates' => :'allowOngoingCycleUpdates', :'id' => :'id', :'reference_id' => :'referenceId', :'version' => :'version', :'status' => :'status', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 408 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
121 122 123 124 125 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 121 def self.openapi_all_of [ :'CreatePricePlanV2Request' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
115 116 117 118 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 115 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 96 def self.openapi_types { :'name' => :'String', :'description' => :'String', :'type' => :'PricePlanType', :'pricing_cycle_config' => :'PricingCycleConfig', :'supported_currencies' => :'Array<String>', :'deferred_revenue' => :'Boolean', :'allow_ongoing_cycle_updates' => :'Boolean', :'id' => :'String', :'reference_id' => :'String', :'version' => :'Integer', :'status' => :'String', :'created_at' => :'Time', :'updated_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 375 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && description == o.description && type == o.type && pricing_cycle_config == o.pricing_cycle_config && supported_currencies == o.supported_currencies && deferred_revenue == o.deferred_revenue && allow_ongoing_cycle_updates == o.allow_ongoing_cycle_updates && id == o.id && reference_id == o.reference_id && version == o.version && status == o.status && created_at == o.created_at && updated_at == o.updated_at end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 503 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 |
#eql?(o) ⇒ Boolean
395 396 397 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 395 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
401 402 403 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 401 def hash [name, description, type, pricing_cycle_config, supported_currencies, deferred_revenue, allow_ongoing_cycle_updates, id, reference_id, version, status, created_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 217 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @name.to_s.length > 50 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.') end if !@description.nil? && @description.to_s.length > 255 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @supported_currencies.nil? invalid_properties.push('invalid value for "supported_currencies", supported_currencies cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @id.to_s.length > 50 invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 50.') end if @reference_id.nil? invalid_properties.push('invalid value for "reference_id", reference_id cannot be nil.') end if @reference_id.to_s.length > 50 invalid_properties.push('invalid value for "reference_id", the character length must be smaller than or equal to 50.') end if @version.nil? invalid_properties.push('invalid value for "version", version cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
479 480 481 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 479 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 485 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
473 474 475 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 473 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/togai_client/models/price_plan_v2.rb', line 277 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @name.to_s.length > 50 return false if !@description.nil? && @description.to_s.length > 255 return false if @type.nil? return false if @supported_currencies.nil? return false if @id.nil? return false if @id.to_s.length > 50 return false if @reference_id.nil? return false if @reference_id.to_s.length > 50 return false if @version.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["DRAFT", "ACTIVE"]) return false unless status_validator.valid?(@status) return false if @created_at.nil? return false if @updated_at.nil? true end |