Class: TenantManagerControlPlane::Models::Promotion
- Inherits:
-
Object
- Object
- TenantManagerControlPlane::Models::Promotion
- Defined in:
- lib/oci/tenant_manager_control_plane/models/promotion.rb
Overview
Promotion information for a subscription.
Constant Summary collapse
- STATUS_ENUM =
[ STATUS_INITIALIZED = 'INITIALIZED'.freeze, STATUS_ACTIVE = 'ACTIVE'.freeze, STATUS_EXPIRED = 'EXPIRED'.freeze, STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#amount ⇒ Float
Total amount of credit for the promotion related to the subscription if there is one.
-
#currency_unit ⇒ String
Currency unit associated with the promotion.
-
#duration ⇒ Integer
How long the promotion related to the subscription, if any, is valid in duration units.
-
#duration_unit ⇒ String
Unit for the duration.
-
#is_intent_to_pay ⇒ BOOLEAN
Whether or not customer intends to pay once the promotion is done.
-
#status ⇒ String
Current status of the promotion related to the subscription if there is one.
-
#time_expired ⇒ DateTime
Date-time for when the promotion ends.
-
#time_started ⇒ DateTime
Date-time for when the promotion starts.
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
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Promotion
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ Promotion
Initializes the object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 96 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 } self.duration = attributes[:'duration'] if attributes[:'duration'] self.duration_unit = attributes[:'durationUnit'] if attributes[:'durationUnit'] raise 'You cannot provide both :durationUnit and :duration_unit' if attributes.key?(:'durationUnit') && attributes.key?(:'duration_unit') self.duration_unit = attributes[:'duration_unit'] if attributes[:'duration_unit'] self.amount = attributes[:'amount'] if attributes[:'amount'] self.status = attributes[:'status'] if attributes[:'status'] self.is_intent_to_pay = attributes[:'isIntentToPay'] unless attributes[:'isIntentToPay'].nil? raise 'You cannot provide both :isIntentToPay and :is_intent_to_pay' if attributes.key?(:'isIntentToPay') && attributes.key?(:'is_intent_to_pay') self.is_intent_to_pay = attributes[:'is_intent_to_pay'] unless attributes[:'is_intent_to_pay'].nil? self.currency_unit = attributes[:'currencyUnit'] if attributes[:'currencyUnit'] raise 'You cannot provide both :currencyUnit and :currency_unit' if attributes.key?(:'currencyUnit') && attributes.key?(:'currency_unit') self.currency_unit = attributes[:'currency_unit'] if attributes[:'currency_unit'] self.time_started = attributes[:'timeStarted'] if attributes[:'timeStarted'] raise 'You cannot provide both :timeStarted and :time_started' if attributes.key?(:'timeStarted') && attributes.key?(:'time_started') self.time_started = attributes[:'time_started'] if attributes[:'time_started'] self.time_expired = attributes[:'timeExpired'] if attributes[:'timeExpired'] raise 'You cannot provide both :timeExpired and :time_expired' if attributes.key?(:'timeExpired') && attributes.key?(:'time_expired') self.time_expired = attributes[:'time_expired'] if attributes[:'time_expired'] end |
Instance Attribute Details
#amount ⇒ Float
Total amount of credit for the promotion related to the subscription if there is one.
28 29 30 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 28 def amount @amount end |
#currency_unit ⇒ String
Currency unit associated with the promotion.
40 41 42 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 40 def currency_unit @currency_unit end |
#duration ⇒ Integer
How long the promotion related to the subscription, if any, is valid in duration units.
20 21 22 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 20 def duration @duration end |
#duration_unit ⇒ String
Unit for the duration.
24 25 26 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 24 def duration_unit @duration_unit end |
#is_intent_to_pay ⇒ BOOLEAN
Whether or not customer intends to pay once the promotion is done.
36 37 38 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 36 def is_intent_to_pay @is_intent_to_pay end |
#status ⇒ String
Current status of the promotion related to the subscription if there is one.
32 33 34 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 32 def status @status end |
#time_expired ⇒ DateTime
Date-time for when the promotion ends.
48 49 50 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 48 def time_expired @time_expired end |
#time_started ⇒ DateTime
Date-time for when the promotion starts.
44 45 46 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 44 def time_started @time_started end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 51 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'duration': :'duration', 'duration_unit': :'durationUnit', 'amount': :'amount', 'status': :'status', 'is_intent_to_pay': :'isIntentToPay', 'currency_unit': :'currencyUnit', 'time_started': :'timeStarted', 'time_expired': :'timeExpired' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 67 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'duration': :'Integer', 'duration_unit': :'String', 'amount': :'Float', 'status': :'String', 'is_intent_to_pay': :'BOOLEAN', 'currency_unit': :'String', 'time_started': :'DateTime', 'time_expired': :'DateTime' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 159 def ==(other) return true if equal?(other) self.class == other.class && duration == other.duration && duration_unit == other.duration_unit && amount == other.amount && status == other.status && is_intent_to_pay == other.is_intent_to_pay && currency_unit == other.currency_unit && time_started == other.time_started && time_expired == other.time_expired end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 196 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) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(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?(other) ⇒ Boolean
176 177 178 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 176 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
185 186 187 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 185 def hash [duration, duration_unit, amount, status, is_intent_to_pay, currency_unit, time_started, time_expired].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
229 230 231 232 233 234 235 236 237 238 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 229 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
223 224 225 |
# File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 223 def to_s to_hash.to_s end |