Class: OCI::Usage::Models::MonthlyRewardSummary
- Inherits:
-
Object
- Object
- OCI::Usage::Models::MonthlyRewardSummary
- 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
-
#available_rewards ⇒ Float
The number of rewards available for a specific usage period.
-
#earned_rewards ⇒ Float
The number of rewards earned for the specific usage period.
-
#eligible_usage_amount ⇒ Float
The eligible usage amount for the usage period.
-
#ineligible_usage_amount ⇒ Float
The ineligible usage amount for the usage period.
-
#is_manual ⇒ BOOLEAN
The boolean parameter to indicate whether or not the available rewards are manually posted.
-
#redeemed_rewards ⇒ Float
The number of rewards redeemed for a specific month.
-
#time_rewards_earned ⇒ DateTime
The date and time when rewards accrue.
-
#time_rewards_expired ⇒ DateTime
The date and time when rewards expire.
-
#time_usage_ended ⇒ DateTime
The end date and time for the usage period.
-
#time_usage_started ⇒ DateTime
The start date and time for the usage period.
-
#usage_amount ⇒ Float
The usage amount for the usage period.
-
#usage_period_key ⇒ String
The usage period ID.
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 = {}) ⇒ MonthlyRewardSummary
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 = {}) ⇒ MonthlyRewardSummary
Initializes the object
123 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 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 123 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_rewards ⇒ Float
The number of rewards available for a specific usage period.
12 13 14 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 12 def available_rewards @available_rewards end |
#earned_rewards ⇒ Float
The number of rewards earned for the specific usage period.
20 21 22 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 20 def earned_rewards @earned_rewards end |
#eligible_usage_amount ⇒ Float
The eligible usage amount for the usage period.
53 54 55 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 53 def eligible_usage_amount @eligible_usage_amount end |
#ineligible_usage_amount ⇒ Float
The ineligible usage amount for the usage period.
58 59 60 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 58 def ineligible_usage_amount @ineligible_usage_amount end |
#is_manual ⇒ BOOLEAN
The boolean parameter to indicate whether or not the available rewards are manually posted.
24 25 26 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 24 def is_manual @is_manual end |
#redeemed_rewards ⇒ Float
The number of rewards redeemed for a specific month.
16 17 18 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 16 def redeemed_rewards @redeemed_rewards end |
#time_rewards_earned ⇒ DateTime
The date and time when rewards accrue.
33 34 35 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 33 def time_rewards_earned @time_rewards_earned end |
#time_rewards_expired ⇒ DateTime
The date and time when rewards expire.
28 29 30 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 28 def time_rewards_expired @time_rewards_expired end |
#time_usage_ended ⇒ DateTime
The end date and time for the usage period.
43 44 45 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 43 def time_usage_ended @time_usage_ended end |
#time_usage_started ⇒ DateTime
The start date and time for the usage period.
38 39 40 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 38 def time_usage_started @time_usage_started end |
#usage_amount ⇒ Float
The usage amount for the usage period.
48 49 50 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 48 def usage_amount @usage_amount end |
#usage_period_key ⇒ String
The usage period ID.
63 64 65 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 63 def usage_period_key @usage_period_key end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 66 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_types ⇒ Object
Attribute type mapping.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 86 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.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 209 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
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 250 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
230 231 232 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 230 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
239 240 241 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 239 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_hash ⇒ Hash
Returns the object in the form of hash
283 284 285 286 287 288 289 290 291 292 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 283 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
277 278 279 |
# File 'lib/oci/usage/models/monthly_reward_summary.rb', line 277 def to_s to_hash.to_s end |