Class: OCI::TenantManagerControlPlane::Models::Promotion
- Inherits:
- 
      Object
      
        - Object
- OCI::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 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    If a subscription is present, indicates the total amount of promotional subscription credits. 
- 
  
    
      #currency_unit  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Currency unit associated with the promotion. 
- 
  
    
      #duration  ⇒ Integer 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Specifies 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 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Speficies whether or not the customer intends to pay after the promotion has expired. 
- 
  
    
      #status  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    If a subscription is present, indicates the current status of the subscription promotion. 
- 
  
    
      #time_expired  ⇒ DateTime 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Date and time when the promotion ends. 
- 
  
    
      #time_started  ⇒ DateTime 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Date and time 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
| 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 138 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 97 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
If a subscription is present, indicates the total amount of promotional subscription credits.
| 29 30 31 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 29 def amount @amount end | 
#currency_unit ⇒ String
Currency unit associated with the promotion.
| 41 42 43 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 41 def currency_unit @currency_unit end | 
#duration ⇒ Integer
Specifies how long the promotion related to the subscription, if any, is valid in duration units.
| 21 22 23 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 21 def duration @duration end | 
#duration_unit ⇒ String
Unit for the duration.
| 25 26 27 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 25 def duration_unit @duration_unit end | 
#is_intent_to_pay ⇒ BOOLEAN
Speficies whether or not the customer intends to pay after the promotion has expired.
| 37 38 39 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 37 def is_intent_to_pay @is_intent_to_pay end | 
#status ⇒ String
If a subscription is present, indicates the current status of the subscription promotion.
| 33 34 35 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 33 def status @status end | 
#time_expired ⇒ DateTime
Date and time when the promotion ends.
| 49 50 51 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 49 def time_expired @time_expired end | 
#time_started ⇒ DateTime
Date and time when the promotion starts.
| 45 46 47 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 45 def time_started @time_started end | 
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
| 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 52 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.
| 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 68 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.
| 160 161 162 163 164 165 166 167 168 169 170 171 172 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 160 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
| 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 197 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
| 177 178 179 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 177 def eql?(other) self == other end | 
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
| 186 187 188 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 186 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
| 230 231 232 233 234 235 236 237 238 239 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 230 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
| 224 225 226 | # File 'lib/oci/tenant_manager_control_plane/models/promotion.rb', line 224 def to_s to_hash.to_s end |