Class: TalonOne::LoyaltyBalanceWithTier

Inherits:
ApiModelBase show all
Defined in:
lib/talon_one_sdk/models/loyalty_balance_with_tier.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ LoyaltyBalanceWithTier

Initializes the object

Parameters:

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

    Model attributes in the form of hash



99
100
101
102
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
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 99

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `TalonOne::LoyaltyBalanceWithTier` 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::LoyaltyBalanceWithTier`. 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?(:'active_points')
    self.active_points = attributes[:'active_points']
  end

  if attributes.key?(:'pending_points')
    self.pending_points = attributes[:'pending_points']
  end

  if attributes.key?(:'spent_points')
    self.spent_points = attributes[:'spent_points']
  end

  if attributes.key?(:'expired_points')
    self.expired_points = attributes[:'expired_points']
  end

  if attributes.key?(:'negative_points')
    self.negative_points = attributes[:'negative_points']
  end

  if attributes.key?(:'current_tier')
    self.current_tier = attributes[:'current_tier']
  end

  if attributes.key?(:'projected_tier')
    self.projected_tier = attributes[:'projected_tier']
  end

  if attributes.key?(:'points_to_next_tier')
    self.points_to_next_tier = attributes[:'points_to_next_tier']
  end

  if attributes.key?(:'next_tier_name')
    self.next_tier_name = attributes[:'next_tier_name']
  end
end

Instance Attribute Details

#active_pointsObject

Total amount of points awarded to this customer and available to spend.



19
20
21
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 19

def active_points
  @active_points
end

#current_tierObject

Customer’s current tier.



34
35
36
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 34

def current_tier
  @current_tier
end

#expired_pointsObject

Total amount of points awarded but never redeemed. They cannot be used anymore.



28
29
30
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 28

def expired_points
  @expired_points
end

#negative_pointsObject

Total amount of negative points. This implies that ‘activePoints` is `0`.



31
32
33
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 31

def negative_points
  @negative_points
end

#next_tier_nameObject

The name of the next higher tier level in the loyalty program. Note: - Returns ‘null` if the customer has reached the highest available tier. - Returns the lowest level tier name if the customer is not currently assigned to any tier.



42
43
44
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 42

def next_tier_name
  @next_tier_name
end

#pending_pointsObject

Total amount of points awarded to this customer but not available until their start date.



22
23
24
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 22

def pending_points
  @pending_points
end

#points_to_next_tierObject

The number of points required to move up a tier.



39
40
41
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 39

def points_to_next_tier
  @points_to_next_tier
end

#projected_tierObject

Returns the value of attribute projected_tier.



36
37
38
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 36

def projected_tier
  @projected_tier
end

#spent_pointsObject

Total amount of points already spent by this customer.



25
26
27
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 25

def spent_points
  @spent_points
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



60
61
62
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 60

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



65
66
67
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 65

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 45

def self.attribute_map
  {
    :'active_points' => :'activePoints',
    :'pending_points' => :'pendingPoints',
    :'spent_points' => :'spentPoints',
    :'expired_points' => :'expiredPoints',
    :'negative_points' => :'negativePoints',
    :'current_tier' => :'currentTier',
    :'projected_tier' => :'projectedTier',
    :'points_to_next_tier' => :'pointsToNextTier',
    :'next_tier_name' => :'nextTierName'
  }
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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 196

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_all_ofObject

List of class defined in allOf (OpenAPI v3)



91
92
93
94
95
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 91

def self.openapi_all_of
  [
  :'LoyaltyBalance'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



85
86
87
88
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 85

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 70

def self.openapi_types
  {
    :'active_points' => :'Float',
    :'pending_points' => :'Float',
    :'spent_points' => :'Float',
    :'expired_points' => :'Float',
    :'negative_points' => :'Float',
    :'current_tier' => :'Tier',
    :'projected_tier' => :'ProjectedTier',
    :'points_to_next_tier' => :'Float',
    :'next_tier_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 167

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active_points == o.active_points &&
      pending_points == o.pending_points &&
      spent_points == o.spent_points &&
      expired_points == o.expired_points &&
      negative_points == o.negative_points &&
      current_tier == o.current_tier &&
      projected_tier == o.projected_tier &&
      points_to_next_tier == o.points_to_next_tier &&
      next_tier_name == o.next_tier_name
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


183
184
185
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 183

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



189
190
191
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 189

def hash
  [active_points, pending_points, spent_points, expired_points, negative_points, current_tier, projected_tier, points_to_next_tier, next_tier_name].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



152
153
154
155
156
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 152

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 218

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

Returns:

  • (Boolean)

    true if the model is valid



160
161
162
163
# File 'lib/talon_one_sdk/models/loyalty_balance_with_tier.rb', line 160

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end