Class: Ifeelgoods::Redemption
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Ifeelgoods::Redemption
- Defined in:
- lib/ifeelgoods/models/redemption.rb
Overview
A Redemption defines the status of a Reward delivery (user eligibility, reward selected, authentication settings, notification channels..)
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#activation_datetime ⇒ Object
Returns the value of attribute activation_datetime.
-
#activation_notification_channels ⇒ Object
Returns the value of attribute activation_notification_channels.
-
#authentication_systems ⇒ Object
List of authentication systems used for the campaign (eg.
[\"email\", \"sms\"]). -
#can_consult ⇒ Object
Returns the value of attribute can_consult.
-
#cancelable ⇒ Object
When a redemption is redeemed, indicates whether the code is cancelable or not.
-
#client ⇒ Object
Returns the value of attribute client.
-
#expiration_datetime ⇒ Object
Redemption expiration date (when the redemption is in pending state, it may have a date after which it is no longer redeemable).
-
#id ⇒ Object
Returns the value of attribute id.
-
#notification_channels ⇒ Object
Returns the value of attribute notification_channels.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#promotion ⇒ Object
Returns the value of attribute promotion.
-
#redeemed_datetime ⇒ Object
Available when redemption has reached a redeemed state.
-
#refunded_datetime ⇒ Object
Available when redemption has reached a refunded state.
-
#reversed ⇒ Object
When a redemption is refunded, indicates whether the code was reversed or not.
-
#reward ⇒ Object
Returns the value of attribute reward.
-
#reward_format ⇒ Object
Returns the value of attribute reward_format.
-
#state ⇒ Object
Returns the value of attribute state.
-
#testing ⇒ Object
Returns the value of attribute testing.
-
#updated_datetime ⇒ Object
Returns the value of attribute updated_datetime.
-
#url ⇒ Object
Returns the value of attribute url.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Redemption
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Redemption
Initializes the object
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 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 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/ifeelgoods/models/redemption.rb', line 170 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Ifeelgoods::Redemption` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Ifeelgoods::Redemption`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.key?(:'testing') self.testing = attributes[:'testing'] end if attributes.key?(:'cancelable') self.cancelable = attributes[:'cancelable'] end if attributes.key?(:'reversed') self.reversed = attributes[:'reversed'] end if attributes.key?(:'client') self.client = attributes[:'client'] end if attributes.key?(:'promotion') self.promotion = attributes[:'promotion'] end if attributes.key?(:'authentication_systems') if (value = attributes[:'authentication_systems']).is_a?(Array) self.authentication_systems = value end end if attributes.key?(:'notification_channels') if (value = attributes[:'notification_channels']).is_a?(Array) self.notification_channels = value end end if attributes.key?(:'activation_notification_channels') if (value = attributes[:'activation_notification_channels']).is_a?(Array) self.activation_notification_channels = value end end if attributes.key?(:'can_consult') self.can_consult = attributes[:'can_consult'] end if attributes.key?(:'reward_format') self.reward_format = attributes[:'reward_format'] end if attributes.key?(:'reward') self.reward = attributes[:'reward'] end if attributes.key?(:'value') self.value = attributes[:'value'] end if attributes.key?(:'activation_datetime') self.activation_datetime = attributes[:'activation_datetime'] end if attributes.key?(:'expiration_datetime') self.expiration_datetime = attributes[:'expiration_datetime'] end if attributes.key?(:'redeemed_datetime') self.redeemed_datetime = attributes[:'redeemed_datetime'] end if attributes.key?(:'refunded_datetime') self.refunded_datetime = attributes[:'refunded_datetime'] end if attributes.key?(:'updated_datetime') self.updated_datetime = attributes[:'updated_datetime'] end end |
Instance Attribute Details
#activation_datetime ⇒ Object
Returns the value of attribute activation_datetime.
54 55 56 |
# File 'lib/ifeelgoods/models/redemption.rb', line 54 def activation_datetime @activation_datetime end |
#activation_notification_channels ⇒ Object
Returns the value of attribute activation_notification_channels.
44 45 46 |
# File 'lib/ifeelgoods/models/redemption.rb', line 44 def activation_notification_channels @activation_notification_channels end |
#authentication_systems ⇒ Object
List of authentication systems used for the campaign (eg. [\"email\", \"sms\"]).
40 41 42 |
# File 'lib/ifeelgoods/models/redemption.rb', line 40 def authentication_systems @authentication_systems end |
#can_consult ⇒ Object
Returns the value of attribute can_consult.
46 47 48 |
# File 'lib/ifeelgoods/models/redemption.rb', line 46 def can_consult @can_consult end |
#cancelable ⇒ Object
When a redemption is redeemed, indicates whether the code is cancelable or not
30 31 32 |
# File 'lib/ifeelgoods/models/redemption.rb', line 30 def cancelable @cancelable end |
#client ⇒ Object
Returns the value of attribute client.
35 36 37 |
# File 'lib/ifeelgoods/models/redemption.rb', line 35 def client @client end |
#expiration_datetime ⇒ Object
Redemption expiration date (when the redemption is in pending state, it may have a date after which it is no longer redeemable).
57 58 59 |
# File 'lib/ifeelgoods/models/redemption.rb', line 57 def expiration_datetime @expiration_datetime end |
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/ifeelgoods/models/redemption.rb', line 19 def id @id end |
#notification_channels ⇒ Object
Returns the value of attribute notification_channels.
42 43 44 |
# File 'lib/ifeelgoods/models/redemption.rb', line 42 def notification_channels @notification_channels end |
#order_id ⇒ Object
Returns the value of attribute order_id.
25 26 27 |
# File 'lib/ifeelgoods/models/redemption.rb', line 25 def order_id @order_id end |
#promotion ⇒ Object
Returns the value of attribute promotion.
37 38 39 |
# File 'lib/ifeelgoods/models/redemption.rb', line 37 def promotion @promotion end |
#redeemed_datetime ⇒ Object
Available when redemption has reached a redeemed state.
60 61 62 |
# File 'lib/ifeelgoods/models/redemption.rb', line 60 def redeemed_datetime @redeemed_datetime end |
#refunded_datetime ⇒ Object
Available when redemption has reached a refunded state.
63 64 65 |
# File 'lib/ifeelgoods/models/redemption.rb', line 63 def refunded_datetime @refunded_datetime end |
#reversed ⇒ Object
When a redemption is refunded, indicates whether the code was reversed or not
33 34 35 |
# File 'lib/ifeelgoods/models/redemption.rb', line 33 def reversed @reversed end |
#reward ⇒ Object
Returns the value of attribute reward.
50 51 52 |
# File 'lib/ifeelgoods/models/redemption.rb', line 50 def reward @reward end |
#reward_format ⇒ Object
Returns the value of attribute reward_format.
48 49 50 |
# File 'lib/ifeelgoods/models/redemption.rb', line 48 def reward_format @reward_format end |
#state ⇒ Object
Returns the value of attribute state.
23 24 25 |
# File 'lib/ifeelgoods/models/redemption.rb', line 23 def state @state end |
#testing ⇒ Object
Returns the value of attribute testing.
27 28 29 |
# File 'lib/ifeelgoods/models/redemption.rb', line 27 def testing @testing end |
#updated_datetime ⇒ Object
Returns the value of attribute updated_datetime.
65 66 67 |
# File 'lib/ifeelgoods/models/redemption.rb', line 65 def updated_datetime @updated_datetime end |
#url ⇒ Object
Returns the value of attribute url.
21 22 23 |
# File 'lib/ifeelgoods/models/redemption.rb', line 21 def url @url end |
#value ⇒ Object
Returns the value of attribute value.
52 53 54 |
# File 'lib/ifeelgoods/models/redemption.rb', line 52 def value @value end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
117 118 119 |
# File 'lib/ifeelgoods/models/redemption.rb', line 117 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
122 123 124 |
# File 'lib/ifeelgoods/models/redemption.rb', line 122 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ifeelgoods/models/redemption.rb', line 90 def self.attribute_map { :'id' => :'id', :'url' => :'url', :'state' => :'state', :'order_id' => :'order_id', :'testing' => :'testing', :'cancelable' => :'cancelable', :'reversed' => :'reversed', :'client' => :'client', :'promotion' => :'promotion', :'authentication_systems' => :'authentication_systems', :'notification_channels' => :'notification_channels', :'activation_notification_channels' => :'activation_notification_channels', :'can_consult' => :'can_consult', :'reward_format' => :'reward_format', :'reward' => :'reward', :'value' => :'value', :'activation_datetime' => :'activation_datetime', :'expiration_datetime' => :'expiration_datetime', :'redeemed_datetime' => :'redeemed_datetime', :'refunded_datetime' => :'refunded_datetime', :'updated_datetime' => :'updated_datetime' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/ifeelgoods/models/redemption.rb', line 345 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/ifeelgoods/models/redemption.rb', line 154 def self.openapi_nullable Set.new([ :'url', :'notification_channels', :'activation_notification_channels', :'can_consult', :'reward_format', :'value', :'expiration_datetime', :'redeemed_datetime', :'refunded_datetime', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/ifeelgoods/models/redemption.rb', line 127 def self.openapi_types { :'id' => :'String', :'url' => :'String', :'state' => :'String', :'order_id' => :'String', :'testing' => :'Boolean', :'cancelable' => :'Boolean', :'reversed' => :'Boolean', :'client' => :'PromotionDetailsClient', :'promotion' => :'RedemptionPromotion', :'authentication_systems' => :'Array<String>', :'notification_channels' => :'Array<String>', :'activation_notification_channels' => :'Array<String>', :'can_consult' => :'Boolean', :'reward_format' => :'RedemptionRewardFormat', :'reward' => :'RedemptionReward', :'value' => :'RedemptionValue', :'activation_datetime' => :'Time', :'expiration_datetime' => :'Time', :'redeemed_datetime' => :'Time', :'refunded_datetime' => :'Time', :'updated_datetime' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/ifeelgoods/models/redemption.rb', line 304 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && url == o.url && state == o.state && order_id == o.order_id && testing == o.testing && cancelable == o.cancelable && reversed == o.reversed && client == o.client && promotion == o.promotion && authentication_systems == o.authentication_systems && notification_channels == o.notification_channels && activation_notification_channels == o.activation_notification_channels && can_consult == o.can_consult && reward_format == o.reward_format && reward == o.reward && value == o.value && activation_datetime == o.activation_datetime && expiration_datetime == o.expiration_datetime && redeemed_datetime == o.redeemed_datetime && refunded_datetime == o.refunded_datetime && updated_datetime == o.updated_datetime end |
#eql?(o) ⇒ Boolean
332 333 334 |
# File 'lib/ifeelgoods/models/redemption.rb', line 332 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
338 339 340 |
# File 'lib/ifeelgoods/models/redemption.rb', line 338 def hash [id, url, state, order_id, testing, cancelable, reversed, client, promotion, authentication_systems, notification_channels, activation_notification_channels, can_consult, reward_format, reward, value, activation_datetime, expiration_datetime, redeemed_datetime, refunded_datetime, updated_datetime].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
277 278 279 280 281 |
# File 'lib/ifeelgoods/models/redemption.rb', line 277 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/ifeelgoods/models/redemption.rb', line 367 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
285 286 287 288 289 290 |
# File 'lib/ifeelgoods/models/redemption.rb', line 285 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' state_validator = EnumAttributeValidator.new('String', ["pending", "booked", "redeemed", "denied", "failed", "refunded", "blocked", "canceled", "expired"]) return false unless state_validator.valid?(@state) true end |