Class: TalonOne::LoyaltyLedgerEntry
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- TalonOne::LoyaltyLedgerEntry
- Defined in:
- lib/talon_one_sdk/models/loyalty_ledger_entry.rb
Overview
A single row of the ledger, describing one addition or deduction.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#archived ⇒ Object
Indicates if the entry belongs to the archived session.
-
#card_id ⇒ Object
Returns the value of attribute card_id.
-
#created ⇒ Object
Returns the value of attribute created.
-
#customer_profile_id ⇒ Object
Returns the value of attribute customer_profile_id.
-
#customer_session_id ⇒ Object
Returns the value of attribute customer_session_id.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#expiry_date ⇒ Object
Returns the value of attribute expiry_date.
-
#flags ⇒ Object
A map of flags providing additional details about the entry.
-
#name ⇒ Object
A name referencing the condition or effect that added this entry, or the specific name provided in an API call.
-
#program_id ⇒ Object
Returns the value of attribute program_id.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#sub_ledger_id ⇒ Object
This specifies if we are adding loyalty points to the main ledger or a subledger.
-
#type ⇒ Object
The type of the ledger transaction.
-
#user_id ⇒ Object
This is the ID of the user who created this entry, if the addition or subtraction was done manually.
-
#validity_duration ⇒ Object
The duration for which the points remain active, relative to the activation date.
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 = {}) ⇒ LoyaltyLedgerEntry
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 = {}) ⇒ LoyaltyLedgerEntry
Initializes the object
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 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 202 203 204 205 206 207 208 209 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 120 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::LoyaltyLedgerEntry` 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 `TalonOne::LoyaltyLedgerEntry`. 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?(:'created') self.created = attributes[:'created'] else self.created = nil end if attributes.key?(:'program_id') self.program_id = attributes[:'program_id'] else self.program_id = nil end if attributes.key?(:'customer_profile_id') self.customer_profile_id = attributes[:'customer_profile_id'] end if attributes.key?(:'card_id') self.card_id = attributes[:'card_id'] end if attributes.key?(:'customer_session_id') self.customer_session_id = attributes[:'customer_session_id'] end if attributes.key?(:'event_id') self.event_id = attributes[:'event_id'] end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'amount') self.amount = attributes[:'amount'] else self.amount = nil end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.key?(:'expiry_date') self.expiry_date = attributes[:'expiry_date'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'sub_ledger_id') self.sub_ledger_id = attributes[:'sub_ledger_id'] else self.sub_ledger_id = nil end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'archived') self.archived = attributes[:'archived'] end if attributes.key?(:'flags') self.flags = attributes[:'flags'] end if attributes.key?(:'validity_duration') self.validity_duration = attributes[:'validity_duration'] end end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
34 35 36 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 34 def amount @amount end |
#archived ⇒ Object
Indicates if the entry belongs to the archived session.
50 51 52 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 50 def archived @archived end |
#card_id ⇒ Object
Returns the value of attribute card_id.
25 26 27 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 25 def card_id @card_id end |
#created ⇒ Object
Returns the value of attribute created.
19 20 21 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 19 def created @created end |
#customer_profile_id ⇒ Object
Returns the value of attribute customer_profile_id.
23 24 25 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 23 def customer_profile_id @customer_profile_id end |
#customer_session_id ⇒ Object
Returns the value of attribute customer_session_id.
27 28 29 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 27 def customer_session_id @customer_session_id end |
#event_id ⇒ Object
Returns the value of attribute event_id.
29 30 31 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 29 def event_id @event_id end |
#expiry_date ⇒ Object
Returns the value of attribute expiry_date.
38 39 40 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 38 def expiry_date @expiry_date end |
#flags ⇒ Object
A map of flags providing additional details about the entry.
53 54 55 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 53 def flags @flags end |
#name ⇒ Object
A name referencing the condition or effect that added this entry, or the specific name provided in an API call.
41 42 43 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 41 def name @name end |
#program_id ⇒ Object
Returns the value of attribute program_id.
21 22 23 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 21 def program_id @program_id end |
#start_date ⇒ Object
Returns the value of attribute start_date.
36 37 38 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 36 def start_date @start_date end |
#sub_ledger_id ⇒ Object
This specifies if we are adding loyalty points to the main ledger or a subledger.
44 45 46 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 44 def sub_ledger_id @sub_ledger_id end |
#type ⇒ Object
The type of the ledger transaction. Possible values are: - ‘addition` - `subtraction` - `expire` - `expiring` (for expiring points ledgers)
32 33 34 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 32 def type @type end |
#user_id ⇒ Object
This is the ID of the user who created this entry, if the addition or subtraction was done manually.
47 48 49 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 47 def user_id @user_id end |
#validity_duration ⇒ Object
The duration for which the points remain active, relative to the activation date. Note: This only applies to points for which ‘awaitsActivation` is `true` and `expiryDate` is not set.
56 57 58 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 56 def validity_duration @validity_duration end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
81 82 83 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 81 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
86 87 88 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 86 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 59 def self.attribute_map { :'created' => :'created', :'program_id' => :'programID', :'customer_profile_id' => :'customerProfileID', :'card_id' => :'cardID', :'customer_session_id' => :'customerSessionID', :'event_id' => :'eventID', :'type' => :'type', :'amount' => :'amount', :'start_date' => :'startDate', :'expiry_date' => :'expiryDate', :'name' => :'name', :'sub_ledger_id' => :'subLedgerID', :'user_id' => :'userID', :'archived' => :'archived', :'flags' => :'flags', :'validity_duration' => :'validityDuration' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 354 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
113 114 115 116 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 113 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 91 def self.openapi_types { :'created' => :'Time', :'program_id' => :'Integer', :'customer_profile_id' => :'String', :'card_id' => :'Integer', :'customer_session_id' => :'String', :'event_id' => :'Integer', :'type' => :'String', :'amount' => :'Float', :'start_date' => :'Time', :'expiry_date' => :'Time', :'name' => :'String', :'sub_ledger_id' => :'String', :'user_id' => :'Integer', :'archived' => :'Boolean', :'flags' => :'LoyaltyLedgerEntryFlags', :'validity_duration' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 318 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && program_id == o.program_id && customer_profile_id == o.customer_profile_id && card_id == o.card_id && customer_session_id == o.customer_session_id && event_id == o.event_id && type == o.type && amount == o.amount && start_date == o.start_date && expiry_date == o.expiry_date && name == o.name && sub_ledger_id == o.sub_ledger_id && user_id == o.user_id && archived == o.archived && flags == o.flags && validity_duration == o.validity_duration end |
#eql?(o) ⇒ Boolean
341 342 343 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 341 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
347 348 349 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 347 def hash [created, program_id, customer_profile_id, card_id, customer_session_id, event_id, type, amount, start_date, expiry_date, name, sub_ledger_id, user_id, archived, flags, validity_duration].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 213 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @program_id.nil? invalid_properties.push('invalid value for "program_id", program_id cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @sub_ledger_id.nil? invalid_properties.push('invalid value for "sub_ledger_id", sub_ledger_id cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 376 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
245 246 247 248 249 250 251 252 253 254 |
# File 'lib/talon_one_sdk/models/loyalty_ledger_entry.rb', line 245 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @created.nil? return false if @program_id.nil? return false if @type.nil? return false if @amount.nil? return false if @name.nil? return false if @sub_ledger_id.nil? true end |