Class: OCI::Usage::Models::RedemptionSummary

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

Overview

The redemption summary for the requested subscription ID and date range.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RedemptionSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :time_redeemed (DateTime)

    The value to assign to the #time_redeemed property

  • :redemption_email (String)

    The value to assign to the #redemption_email property

  • :redemption_code (String)

    The value to assign to the #redemption_code property

  • :invoice_number (String)

    The value to assign to the #invoice_number property

  • :invoice_total_amount (Float)

    The value to assign to the #invoice_total_amount property

  • :invoice_currency (String)

    The value to assign to the #invoice_currency property

  • :redeemed_rewards (Float)

    The value to assign to the #redeemed_rewards property

  • :base_rewards (Float)

    The value to assign to the #base_rewards property

  • :fx_rate (Float)

    The value to assign to the #fx_rate property

  • :time_invoiced (DateTime)

    The value to assign to the #time_invoiced property



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
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
# File 'lib/oci/usage/models/redemption_summary.rb', line 103

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

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

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

  self.redemption_email = attributes[:'redemptionEmail'] if attributes[:'redemptionEmail']

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

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

  self.redemption_code = attributes[:'redemptionCode'] if attributes[:'redemptionCode']

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

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

  self.invoice_number = attributes[:'invoiceNumber'] if attributes[:'invoiceNumber']

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

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

  self.invoice_total_amount = attributes[:'invoiceTotalAmount'] if attributes[:'invoiceTotalAmount']

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

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

  self.invoice_currency = attributes[:'invoiceCurrency'] if attributes[:'invoiceCurrency']

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

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

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

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

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

  self.fx_rate = attributes[:'fxRate'] if attributes[:'fxRate']

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

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

  self.time_invoiced = attributes[:'timeInvoiced'] if attributes[:'timeInvoiced']

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

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

Instance Attribute Details

#base_rewardsFloat

It provides the redeemed rewards in base/subscription currency.

Returns:

  • (Float)


41
42
43
# File 'lib/oci/usage/models/redemption_summary.rb', line 41

def base_rewards
  @base_rewards
end

#fx_rateFloat

It provides the fxRate between invoice currency and subscription currency.

Returns:

  • (Float)


45
46
47
# File 'lib/oci/usage/models/redemption_summary.rb', line 45

def fx_rate
  @fx_rate
end

#invoice_currencyString

The currency associated with invoice.

Returns:

  • (String)


33
34
35
# File 'lib/oci/usage/models/redemption_summary.rb', line 33

def invoice_currency
  @invoice_currency
end

#invoice_numberString

It provides the invoice number against the redemption.

Returns:

  • (String)


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

def invoice_number
  @invoice_number
end

#invoice_total_amountFloat

It provides the invoice total amount of given redemption.

Returns:

  • (Float)


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

def invoice_total_amount
  @invoice_total_amount
end

#redeemed_rewardsFloat

It provides the redeemed rewards in invoice currency.

Returns:

  • (Float)


37
38
39
# File 'lib/oci/usage/models/redemption_summary.rb', line 37

def redeemed_rewards
  @redeemed_rewards
end

#redemption_codeString

The redemption code used in the Billing Center during the reward redemption process.

Returns:

  • (String)


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

def redemption_code
  @redemption_code
end

#redemption_emailString

It provides the redemption email id.

Returns:

  • (String)


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

def redemption_email
  @redemption_email
end

#time_invoicedDateTime

It provides the invoice date.

Returns:

  • (DateTime)


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

def time_invoiced
  @time_invoiced
end

#time_redeemedDateTime

It provides redeem date.

Returns:

  • (DateTime)


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

def time_redeemed
  @time_redeemed
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/oci/usage/models/redemption_summary.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_redeemed': :'timeRedeemed',
    'redemption_email': :'redemptionEmail',
    'redemption_code': :'redemptionCode',
    'invoice_number': :'invoiceNumber',
    'invoice_total_amount': :'invoiceTotalAmount',
    'invoice_currency': :'invoiceCurrency',
    'redeemed_rewards': :'redeemedRewards',
    'base_rewards': :'baseRewards',
    'fx_rate': :'fxRate',
    'time_invoiced': :'timeInvoiced'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_redeemed': :'DateTime',
    'redemption_email': :'String',
    'redemption_code': :'String',
    'invoice_number': :'String',
    'invoice_total_amount': :'Float',
    'invoice_currency': :'String',
    'redeemed_rewards': :'Float',
    'base_rewards': :'Float',
    'fx_rate': :'Float',
    'time_invoiced': :'DateTime'
    # 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



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/oci/usage/models/redemption_summary.rb', line 177

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

  self.class == other.class &&
    time_redeemed == other.time_redeemed &&
    redemption_email == other.redemption_email &&
    redemption_code == other.redemption_code &&
    invoice_number == other.invoice_number &&
    invoice_total_amount == other.invoice_total_amount &&
    invoice_currency == other.invoice_currency &&
    redeemed_rewards == other.redeemed_rewards &&
    base_rewards == other.base_rewards &&
    fx_rate == other.fx_rate &&
    time_invoiced == other.time_invoiced
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



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/oci/usage/models/redemption_summary.rb', line 216

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


196
197
198
# File 'lib/oci/usage/models/redemption_summary.rb', line 196

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



205
206
207
# File 'lib/oci/usage/models/redemption_summary.rb', line 205

def hash
  [time_redeemed, redemption_email, redemption_code, invoice_number, invoice_total_amount, invoice_currency, redeemed_rewards, base_rewards, fx_rate, time_invoiced].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



249
250
251
252
253
254
255
256
257
258
# File 'lib/oci/usage/models/redemption_summary.rb', line 249

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



243
244
245
# File 'lib/oci/usage/models/redemption_summary.rb', line 243

def to_s
  to_hash.to_s
end