Class: TalonOne::CouponDeletionFilters

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

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ CouponDeletionFilters

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
210
211
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 140

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

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

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

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

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

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

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

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

  if attributes.key?(:'exact_match')
    self.exact_match = attributes[:'exact_match']
  else
    self.exact_match = false
  end

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

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

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

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

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

Instance Attribute Details

#batch_idObject

Filter results by batches of coupons



49
50
51
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 49

def batch_id
  @batch_id
end

#created_afterObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



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

def created_after
  @created_after
end

#created_beforeObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



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

def created_before
  @created_before
end

#exact_matchObject

Filter results to an exact case-insensitive matching against the coupon code



43
44
45
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 43

def exact_match
  @exact_match
end

#expires_afterObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



55
56
57
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 55

def expires_after
  @expires_after
end

#expires_beforeObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



58
59
60
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 58

def expires_before
  @expires_before
end

#recipient_integration_idObject

Filter results by match with a profile id specified in the coupon’s ‘RecipientIntegrationId` field.



40
41
42
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 40

def recipient_integration_id
  @recipient_integration_id
end

#redeemedObject

  • ‘true`: only coupons where `usageCounter > 0` will be returned. - `false`: only coupons where `usageCounter = 0` will be returned. Note: This field cannot be used in conjunction with the `usable` query parameter.



37
38
39
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 37

def redeemed
  @redeemed
end

#referral_idObject

Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.



52
53
54
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 52

def referral_id
  @referral_id
end

#starts_afterObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



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

def starts_after
  @starts_after
end

#starts_beforeObject

Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.



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

def starts_before
  @starts_before
end

#usableObject

  • ‘true`: only coupons where `usageCounter < usageLimit` will be returned. - `false`: only coupons where `usageCounter >= usageLimit` will be returned. - This field cannot be used in conjunction with the `usable` query parameter.



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

def usable
  @usable
end

#validObject

  • ‘expired`: Matches coupons in which the expiration date is set and in the past. - `validNow`: Matches coupons in which the start date is null or in the past and the expiration date is null or in the future. - `validFuture`: Matches coupons in which the start date is set and in the future.



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

def valid
  @valid
end

#valueObject

Filter results by the coupon code



46
47
48
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 46

def value
  @value
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



103
104
105
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 103

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 108

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 83

def self.attribute_map
  {
    :'created_before' => :'createdBefore',
    :'created_after' => :'createdAfter',
    :'starts_after' => :'startsAfter',
    :'starts_before' => :'startsBefore',
    :'valid' => :'valid',
    :'usable' => :'usable',
    :'redeemed' => :'redeemed',
    :'recipient_integration_id' => :'recipientIntegrationId',
    :'exact_match' => :'exactMatch',
    :'value' => :'value',
    :'batch_id' => :'batchId',
    :'referral_id' => :'referralId',
    :'expires_after' => :'expiresAfter',
    :'expires_before' => :'expiresBefore'
  }
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



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 276

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_nullableObject

List of attributes with nullable: true



133
134
135
136
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 133

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

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 113

def self.openapi_types
  {
    :'created_before' => :'Time',
    :'created_after' => :'Time',
    :'starts_after' => :'Time',
    :'starts_before' => :'Time',
    :'valid' => :'String',
    :'usable' => :'Boolean',
    :'redeemed' => :'Boolean',
    :'recipient_integration_id' => :'String',
    :'exact_match' => :'Boolean',
    :'value' => :'String',
    :'batch_id' => :'String',
    :'referral_id' => :'Integer',
    :'expires_after' => :'Time',
    :'expires_before' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 242

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created_before == o.created_before &&
      created_after == o.created_after &&
      starts_after == o.starts_after &&
      starts_before == o.starts_before &&
      valid == o.valid &&
      usable == o.usable &&
      redeemed == o.redeemed &&
      recipient_integration_id == o.recipient_integration_id &&
      exact_match == o.exact_match &&
      value == o.value &&
      batch_id == o.batch_id &&
      referral_id == o.referral_id &&
      expires_after == o.expires_after &&
      expires_before == o.expires_before
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


263
264
265
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 263

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



269
270
271
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 269

def hash
  [created_before, created_after, starts_after, starts_before, valid, usable, redeemed, recipient_integration_id, exact_match, value, batch_id, referral_id, expires_after, expires_before].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



215
216
217
218
219
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 215

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



298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 298

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



223
224
225
226
227
228
# File 'lib/talon_one_sdk/models/coupon_deletion_filters.rb', line 223

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  valid_validator = EnumAttributeValidator.new('String', ["expired", "validNow", "validFuture"])
  return false unless valid_validator.valid?(@valid)
  true
end