Class: OCI::Usage::Models::MonthlyRewardSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/usage/models/monthly_reward_summary.rb

Overview

Object describing the monthly rewards summary for the requested subscription ID.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MonthlyRewardSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



124
125
126
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
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
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 124

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.available_rewards = attributes[:'availableRewards'] if attributes[:'availableRewards']

  raise 'You cannot provide both :availableRewards and :available_rewards' if attributes.key?(:'availableRewards') && attributes.key?(:'available_rewards')

  self.available_rewards = attributes[:'available_rewards'] if attributes[:'available_rewards']

  self.redeemed_rewards = attributes[:'redeemedRewards'] if attributes[:'redeemedRewards']

  raise 'You cannot provide both :redeemedRewards and :redeemed_rewards' if attributes.key?(:'redeemedRewards') && attributes.key?(:'redeemed_rewards')

  self.redeemed_rewards = attributes[:'redeemed_rewards'] if attributes[:'redeemed_rewards']

  self.earned_rewards = attributes[:'earnedRewards'] if attributes[:'earnedRewards']

  raise 'You cannot provide both :earnedRewards and :earned_rewards' if attributes.key?(:'earnedRewards') && attributes.key?(:'earned_rewards')

  self.earned_rewards = attributes[:'earned_rewards'] if attributes[:'earned_rewards']

  self.is_manual = attributes[:'isManual'] unless attributes[:'isManual'].nil?

  raise 'You cannot provide both :isManual and :is_manual' if attributes.key?(:'isManual') && attributes.key?(:'is_manual')

  self.is_manual = attributes[:'is_manual'] unless attributes[:'is_manual'].nil?

  self.time_rewards_expired = attributes[:'timeRewardsExpired'] if attributes[:'timeRewardsExpired']

  raise 'You cannot provide both :timeRewardsExpired and :time_rewards_expired' if attributes.key?(:'timeRewardsExpired') && attributes.key?(:'time_rewards_expired')

  self.time_rewards_expired = attributes[:'time_rewards_expired'] if attributes[:'time_rewards_expired']

  self.time_rewards_earned = attributes[:'timeRewardsEarned'] if attributes[:'timeRewardsEarned']

  raise 'You cannot provide both :timeRewardsEarned and :time_rewards_earned' if attributes.key?(:'timeRewardsEarned') && attributes.key?(:'time_rewards_earned')

  self.time_rewards_earned = attributes[:'time_rewards_earned'] if attributes[:'time_rewards_earned']

  self.time_usage_started = attributes[:'timeUsageStarted'] if attributes[:'timeUsageStarted']

  raise 'You cannot provide both :timeUsageStarted and :time_usage_started' if attributes.key?(:'timeUsageStarted') && attributes.key?(:'time_usage_started')

  self.time_usage_started = attributes[:'time_usage_started'] if attributes[:'time_usage_started']

  self.time_usage_ended = attributes[:'timeUsageEnded'] if attributes[:'timeUsageEnded']

  raise 'You cannot provide both :timeUsageEnded and :time_usage_ended' if attributes.key?(:'timeUsageEnded') && attributes.key?(:'time_usage_ended')

  self.time_usage_ended = attributes[:'time_usage_ended'] if attributes[:'time_usage_ended']

  self.usage_amount = attributes[:'usageAmount'] if attributes[:'usageAmount']

  raise 'You cannot provide both :usageAmount and :usage_amount' if attributes.key?(:'usageAmount') && attributes.key?(:'usage_amount')

  self.usage_amount = attributes[:'usage_amount'] if attributes[:'usage_amount']

  self.eligible_usage_amount = attributes[:'eligibleUsageAmount'] if attributes[:'eligibleUsageAmount']

  raise 'You cannot provide both :eligibleUsageAmount and :eligible_usage_amount' if attributes.key?(:'eligibleUsageAmount') && attributes.key?(:'eligible_usage_amount')

  self.eligible_usage_amount = attributes[:'eligible_usage_amount'] if attributes[:'eligible_usage_amount']

  self.ineligible_usage_amount = attributes[:'ineligibleUsageAmount'] if attributes[:'ineligibleUsageAmount']

  raise 'You cannot provide both :ineligibleUsageAmount and :ineligible_usage_amount' if attributes.key?(:'ineligibleUsageAmount') && attributes.key?(:'ineligible_usage_amount')

  self.ineligible_usage_amount = attributes[:'ineligible_usage_amount'] if attributes[:'ineligible_usage_amount']

  self.usage_period_key = attributes[:'usagePeriodKey'] if attributes[:'usagePeriodKey']

  raise 'You cannot provide both :usagePeriodKey and :usage_period_key' if attributes.key?(:'usagePeriodKey') && attributes.key?(:'usage_period_key')

  self.usage_period_key = attributes[:'usage_period_key'] if attributes[:'usage_period_key']
end

Instance Attribute Details

#available_rewardsFloat

The number of rewards available for a specific usage period.

Returns:

  • (Float)


13
14
15
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 13

def available_rewards
  @available_rewards
end

#earned_rewardsFloat

The number of rewards earned for the specific usage period.

Returns:

  • (Float)


21
22
23
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 21

def earned_rewards
  @earned_rewards
end

#eligible_usage_amountFloat

The eligible usage amount for the usage period.

Returns:

  • (Float)


54
55
56
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 54

def eligible_usage_amount
  @eligible_usage_amount
end

#ineligible_usage_amountFloat

The ineligible usage amount for the usage period.

Returns:

  • (Float)


59
60
61
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 59

def ineligible_usage_amount
  @ineligible_usage_amount
end

#is_manualBOOLEAN

The boolean parameter to indicate whether or not the available rewards are manually posted.

Returns:

  • (BOOLEAN)


25
26
27
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 25

def is_manual
  @is_manual
end

#redeemed_rewardsFloat

The number of rewards redeemed for a specific month.

Returns:

  • (Float)


17
18
19
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 17

def redeemed_rewards
  @redeemed_rewards
end

#time_rewards_earnedDateTime

The date and time when rewards accrue.

Returns:

  • (DateTime)


34
35
36
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 34

def time_rewards_earned
  @time_rewards_earned
end

#time_rewards_expiredDateTime

The date and time when rewards expire.

Returns:

  • (DateTime)


29
30
31
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 29

def time_rewards_expired
  @time_rewards_expired
end

#time_usage_endedDateTime

The end date and time for the usage period.

Returns:

  • (DateTime)


44
45
46
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 44

def time_usage_ended
  @time_usage_ended
end

#time_usage_startedDateTime

The start date and time for the usage period.

Returns:

  • (DateTime)


39
40
41
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 39

def time_usage_started
  @time_usage_started
end

#usage_amountFloat

The usage amount for the usage period.

Returns:

  • (Float)


49
50
51
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 49

def usage_amount
  @usage_amount
end

#usage_period_keyString

The usage period ID.

Returns:

  • (String)


64
65
66
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 64

def usage_period_key
  @usage_period_key
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 67

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'available_rewards': :'availableRewards',
    'redeemed_rewards': :'redeemedRewards',
    'earned_rewards': :'earnedRewards',
    'is_manual': :'isManual',
    'time_rewards_expired': :'timeRewardsExpired',
    'time_rewards_earned': :'timeRewardsEarned',
    'time_usage_started': :'timeUsageStarted',
    'time_usage_ended': :'timeUsageEnded',
    'usage_amount': :'usageAmount',
    'eligible_usage_amount': :'eligibleUsageAmount',
    'ineligible_usage_amount': :'ineligibleUsageAmount',
    'usage_period_key': :'usagePeriodKey'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 87

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'available_rewards': :'Float',
    'redeemed_rewards': :'Float',
    'earned_rewards': :'Float',
    'is_manual': :'BOOLEAN',
    'time_rewards_expired': :'DateTime',
    'time_rewards_earned': :'DateTime',
    'time_usage_started': :'DateTime',
    'time_usage_ended': :'DateTime',
    'usage_amount': :'Float',
    'eligible_usage_amount': :'Float',
    'ineligible_usage_amount': :'Float',
    'usage_period_key': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 210

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    available_rewards == other.available_rewards &&
    redeemed_rewards == other.redeemed_rewards &&
    earned_rewards == other.earned_rewards &&
    is_manual == other.is_manual &&
    time_rewards_expired == other.time_rewards_expired &&
    time_rewards_earned == other.time_rewards_earned &&
    time_usage_started == other.time_usage_started &&
    time_usage_ended == other.time_usage_ended &&
    usage_amount == other.usage_amount &&
    eligible_usage_amount == other.eligible_usage_amount &&
    ineligible_usage_amount == other.ineligible_usage_amount &&
    usage_period_key == other.usage_period_key
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



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/oci/usage/models/monthly_reward_summary.rb', line 251

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


231
232
233
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 231

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



240
241
242
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 240

def hash
  [available_rewards, redeemed_rewards, earned_rewards, is_manual, time_rewards_expired, time_rewards_earned, time_usage_started, time_usage_ended, usage_amount, eligible_usage_amount, ineligible_usage_amount, usage_period_key].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



284
285
286
287
288
289
290
291
292
293
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 284

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



278
279
280
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 278

def to_s
  to_hash.to_s
end