Class: TalonOne::RuleFailureReason

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

Overview

Details about why a rule failed.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 119

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

  if attributes.key?(:'campaign_name')
    self.campaign_name = attributes[:'campaign_name']
  else
    self.campaign_name = nil
  end

  if attributes.key?(:'ruleset_id')
    self.ruleset_id = attributes[:'ruleset_id']
  else
    self.ruleset_id = nil
  end

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

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

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

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

  if attributes.key?(:'rule_index')
    self.rule_index = attributes[:'rule_index']
  else
    self.rule_index = nil
  end

  if attributes.key?(:'rule_name')
    self.rule_name = attributes[:'rule_name']
  else
    self.rule_name = nil
  end

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

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

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

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

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

Instance Attribute Details

#campaign_idObject

The ID of the campaign that contains the rule that failed.



20
21
22
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 20

def campaign_id
  @campaign_id
end

#campaign_nameObject

The name of the campaign that contains the rule that failed.



23
24
25
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 23

def campaign_name
  @campaign_name
end

#condition_indexObject

The index of the condition that failed.



47
48
49
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 47

def condition_index
  @condition_index
end

#coupon_idObject

The ID of the coupon that was being evaluated at the time of the rule failure.



29
30
31
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 29

def coupon_id
  @coupon_id
end

#coupon_valueObject

The code of the coupon that was being evaluated at the time of the rule failure.



32
33
34
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 32

def coupon_value
  @coupon_value
end

#detailsObject

More details about the failure.



53
54
55
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 53

def details
  @details
end

#effect_indexObject

The index of the effect that failed.



50
51
52
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 50

def effect_index
  @effect_index
end

#evaluation_group_idObject

The ID of the evaluation group. For more information, see [Managing campaign evaluation](docs.talon.one/docs/product/applications/managing-campaign-evaluation).



56
57
58
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 56

def evaluation_group_id
  @evaluation_group_id
end

#evaluation_group_modeObject

The evaluation mode of the evaluation group. For more information, see [Managing campaign evaluation](docs.talon.one/docs/product/applications/managing-campaign-



59
60
61
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 59

def evaluation_group_mode
  @evaluation_group_mode
end

#referral_idObject

The ID of the referral that was being evaluated at the time of the rule failure.



35
36
37
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 35

def referral_id
  @referral_id
end

#referral_valueObject

The code of the referral that was being evaluated at the time of the rule failure.



38
39
40
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 38

def referral_value
  @referral_value
end

#rule_indexObject

The index of the rule that failed within the ruleset.



41
42
43
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 41

def rule_index
  @rule_index
end

#rule_nameObject

The name of the rule that failed within the ruleset.



44
45
46
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 44

def rule_name
  @rule_name
end

#ruleset_idObject

The ID of the ruleset that contains the rule that failed.



26
27
28
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 26

def ruleset_id
  @ruleset_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



82
83
84
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 82

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



87
88
89
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 87

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 62

def self.attribute_map
  {
    :'campaign_id' => :'campaignID',
    :'campaign_name' => :'campaignName',
    :'ruleset_id' => :'rulesetID',
    :'coupon_id' => :'couponID',
    :'coupon_value' => :'couponValue',
    :'referral_id' => :'referralID',
    :'referral_value' => :'referralValue',
    :'rule_index' => :'ruleIndex',
    :'rule_name' => :'ruleName',
    :'condition_index' => :'conditionIndex',
    :'effect_index' => :'effectIndex',
    :'details' => :'details',
    :'evaluation_group_id' => :'evaluationGroupID',
    :'evaluation_group_mode' => :'evaluationGroupMode'
  }
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



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 326

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



112
113
114
115
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 112

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

.openapi_typesObject

Attribute type mapping.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 92

def self.openapi_types
  {
    :'campaign_id' => :'Integer',
    :'campaign_name' => :'String',
    :'ruleset_id' => :'Integer',
    :'coupon_id' => :'Integer',
    :'coupon_value' => :'String',
    :'referral_id' => :'Integer',
    :'referral_value' => :'String',
    :'rule_index' => :'Integer',
    :'rule_name' => :'String',
    :'condition_index' => :'Integer',
    :'effect_index' => :'Integer',
    :'details' => :'String',
    :'evaluation_group_id' => :'Integer',
    :'evaluation_group_mode' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 292

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      campaign_id == o.campaign_id &&
      campaign_name == o.campaign_name &&
      ruleset_id == o.ruleset_id &&
      coupon_id == o.coupon_id &&
      coupon_value == o.coupon_value &&
      referral_id == o.referral_id &&
      referral_value == o.referral_value &&
      rule_index == o.rule_index &&
      rule_name == o.rule_name &&
      condition_index == o.condition_index &&
      effect_index == o.effect_index &&
      details == o.details &&
      evaluation_group_id == o.evaluation_group_id &&
      evaluation_group_mode == o.evaluation_group_mode
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


313
314
315
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 313

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



319
320
321
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 319

def hash
  [campaign_id, campaign_name, ruleset_id, coupon_id, coupon_value, referral_id, referral_value, rule_index, rule_name, condition_index, effect_index, details, evaluation_group_id, evaluation_group_mode].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 202

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @campaign_id.nil?
    invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
  end

  if @campaign_name.nil?
    invalid_properties.push('invalid value for "campaign_name", campaign_name cannot be nil.')
  end

  if @ruleset_id.nil?
    invalid_properties.push('invalid value for "ruleset_id", ruleset_id cannot be nil.')
  end

  if @rule_index.nil?
    invalid_properties.push('invalid value for "rule_index", rule_index cannot be nil.')
  end

  if @rule_name.nil?
    invalid_properties.push('invalid value for "rule_name", rule_name cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 348

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



230
231
232
233
234
235
236
237
238
# File 'lib/talon_one_sdk/models/rule_failure_reason.rb', line 230

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @campaign_id.nil?
  return false if @campaign_name.nil?
  return false if @ruleset_id.nil?
  return false if @rule_index.nil?
  return false if @rule_name.nil?
  true
end