Class: KlaviyoAPI::FlowEmail

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo-api-sdk/models/flow_email.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FlowEmail

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 115

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::FlowEmail` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::FlowEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

  if attributes.key?(:'smart_sending_enabled')
    self.smart_sending_enabled = attributes[:'smart_sending_enabled']
  else
    self.smart_sending_enabled = true
  end

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

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

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

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

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

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

Instance Attribute Details

#add_tracking_paramsObject

Returns the value of attribute add_tracking_params.



38
39
40
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 38

def add_tracking_params
  @add_tracking_params
end

#additional_filtersObject

Returns the value of attribute additional_filters.



42
43
44
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 42

def additional_filters
  @additional_filters
end

#bcc_emailObject

Returns the value of attribute bcc_email.



26
27
28
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 26

def bcc_email
  @bcc_email
end

#cc_emailObject

Returns the value of attribute cc_email.



24
25
26
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 24

def cc_email
  @cc_email
end

#custom_tracking_paramsObject

Returns the value of attribute custom_tracking_params.



40
41
42
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 40

def custom_tracking_params
  @custom_tracking_params
end

#from_emailObject

Returns the value of attribute from_email.



18
19
20
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 18

def from_email
  @from_email
end

#from_labelObject

Returns the value of attribute from_label.



20
21
22
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 20

def from_label
  @from_label
end

#idObject

Returns the value of attribute id.



46
47
48
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 46

def id
  @id
end

#nameObject

Returns the value of attribute name.



44
45
46
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 44

def name
  @name
end

#preview_textObject

Returns the value of attribute preview_text.



30
31
32
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 30

def preview_text
  @preview_text
end

#reply_to_emailObject

Returns the value of attribute reply_to_email.



22
23
24
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 22

def reply_to_email
  @reply_to_email
end

#smart_sending_enabledObject

Returns the value of attribute smart_sending_enabled.



34
35
36
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 34

def smart_sending_enabled
  @smart_sending_enabled
end

#subject_lineObject

Returns the value of attribute subject_line.



28
29
30
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 28

def subject_line
  @subject_line
end

#template_idObject

Returns the value of attribute template_id.



32
33
34
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 32

def template_id
  @template_id
end

#transactionalObject

Returns the value of attribute transactional.



36
37
38
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 36

def transactional
  @transactional
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



70
71
72
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 70

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 49

def self.attribute_map
  {
    :'from_email' => :'from_email',
    :'from_label' => :'from_label',
    :'reply_to_email' => :'reply_to_email',
    :'cc_email' => :'cc_email',
    :'bcc_email' => :'bcc_email',
    :'subject_line' => :'subject_line',
    :'preview_text' => :'preview_text',
    :'template_id' => :'template_id',
    :'smart_sending_enabled' => :'smart_sending_enabled',
    :'transactional' => :'transactional',
    :'add_tracking_params' => :'add_tracking_params',
    :'custom_tracking_params' => :'custom_tracking_params',
    :'additional_filters' => :'additional_filters',
    :'name' => :'name',
    :'id' => :'id'
  }
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



247
248
249
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 247

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 96

def self.openapi_nullable
  Set.new([
    :'from_email',
    :'from_label',
    :'reply_to_email',
    :'cc_email',
    :'bcc_email',
    :'subject_line',
    :'preview_text',
    :'template_id',
    :'custom_tracking_params',
    :'additional_filters',
    :'name',
    :'id'
  ])
end

.openapi_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 75

def self.openapi_types
  {
    :'from_email' => :'String',
    :'from_label' => :'String',
    :'reply_to_email' => :'String',
    :'cc_email' => :'String',
    :'bcc_email' => :'String',
    :'subject_line' => :'String',
    :'preview_text' => :'String',
    :'template_id' => :'String',
    :'smart_sending_enabled' => :'Boolean',
    :'transactional' => :'Boolean',
    :'add_tracking_params' => :'Boolean',
    :'custom_tracking_params' => :'Array<UtmParam>',
    :'additional_filters' => :'FlowEmailAdditionalFilters',
    :'name' => :'String',
    :'id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 212

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      from_email == o.from_email &&
      from_label == o.from_label &&
      reply_to_email == o.reply_to_email &&
      cc_email == o.cc_email &&
      bcc_email == o.bcc_email &&
      subject_line == o.subject_line &&
      preview_text == o.preview_text &&
      template_id == o.template_id &&
      smart_sending_enabled == o.smart_sending_enabled &&
      transactional == o.transactional &&
      add_tracking_params == o.add_tracking_params &&
      custom_tracking_params == o.custom_tracking_params &&
      additional_filters == o.additional_filters &&
      name == o.name &&
      id == o.id
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 278

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = KlaviyoAPI.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 349

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 254

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


234
235
236
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 234

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



240
241
242
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 240

def hash
  [from_email, from_label, reply_to_email, cc_email, bcc_email, subject_line, preview_text, template_id, smart_sending_enabled, transactional, add_tracking_params, custom_tracking_params, additional_filters, name, id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



199
200
201
202
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 199

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



325
326
327
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 325

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 331

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



319
320
321
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 319

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



206
207
208
# File 'lib/klaviyo-api-sdk/models/flow_email.rb', line 206

def valid?
  true
end