Class: Zernio::SendWhatsAppFlowMessageRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/send_whats_app_flow_message_request.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 = {}) ⇒ SendWhatsAppFlowMessageRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 123

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

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

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

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

  if attributes.key?(:'flow_action')
    self.flow_action = attributes[:'flow_action']
  else
    self.flow_action = 'navigate'
  end

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

WhatsApp social account ID



19
20
21
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 19

def 
  @account_id
end

#bodyObject

Message body text



39
40
41
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 39

def body
  @body
end

#draftObject

Set true to test an unpublished (DRAFT) flow



47
48
49
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 47

def draft
  @draft
end

#flow_actionObject

Action type: navigate opens a screen directly, data_exchange hits your endpoint first



31
32
33
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 31

def flow_action
  @flow_action
end

#flow_action_payloadObject

Returns the value of attribute flow_action_payload.



36
37
38
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 36

def flow_action_payload
  @flow_action_payload
end

#flow_ctaObject

CTA button text (e.g. 'Book Now', 'Sign Up')



28
29
30
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 28

def flow_cta
  @flow_cta
end

#flow_idObject

Published flow ID



25
26
27
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 25

def flow_id
  @flow_id
end

#flow_tokenObject

Unique token to correlate responses. If omitted, auto-generated as ':' so the response can be attributed to this flow in the Flow Responses view.



34
35
36
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 34

def flow_token
  @flow_token
end

Optional footer text



44
45
46
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 44

def footer
  @footer
end

#headerObject

Returns the value of attribute header.



41
42
43
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 41

def header
  @header
end

#toObject

Recipient phone number (E.164 format, e.g. +1234567890)



22
23
24
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 22

def to
  @to
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



94
95
96
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 94

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 72

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'to' => :'to',
    :'flow_id' => :'flow_id',
    :'flow_cta' => :'flow_cta',
    :'flow_action' => :'flow_action',
    :'flow_token' => :'flow_token',
    :'flow_action_payload' => :'flow_action_payload',
    :'body' => :'body',
    :'header' => :'header',
    :'footer' => :'footer',
    :'draft' => :'draft'
  }
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



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 357

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



116
117
118
119
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 116

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

.openapi_typesObject

Attribute type mapping.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 99

def self.openapi_types
  {
    :'account_id' => :'String',
    :'to' => :'String',
    :'flow_id' => :'String',
    :'flow_cta' => :'String',
    :'flow_action' => :'String',
    :'flow_token' => :'String',
    :'flow_action_payload' => :'SendWhatsAppFlowMessageRequestFlowActionPayload',
    :'body' => :'String',
    :'header' => :'SendWhatsAppFlowMessageRequestHeader',
    :'footer' => :'String',
    :'draft' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 326

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      to == o.to &&
      flow_id == o.flow_id &&
      flow_cta == o.flow_cta &&
      flow_action == o.flow_action &&
      flow_token == o.flow_token &&
      flow_action_payload == o.flow_action_payload &&
      body == o.body &&
      header == o.header &&
      footer == o.footer &&
      draft == o.draft
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


344
345
346
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 344

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



350
351
352
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 350

def hash
  [, to, flow_id, flow_cta, flow_action, flow_token, flow_action_payload, body, header, footer, draft].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



196
197
198
199
200
201
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
227
228
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 196

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

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

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

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

  if @flow_cta.to_s.length > 20
    invalid_properties.push('invalid value for "flow_cta", the character length must be smaller than or equal to 20.')
  end

  if !@flow_token.nil? && @flow_token.to_s.length > 200
    invalid_properties.push('invalid value for "flow_token", the character length must be smaller than or equal to 200.')
  end

  if @body.nil?
    invalid_properties.push('invalid value for "body", body 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



379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 379

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



232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/zernio-sdk/models/send_whats_app_flow_message_request.rb', line 232

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @to.nil?
  return false if @flow_id.nil?
  return false if @flow_cta.nil?
  return false if @flow_cta.to_s.length > 20
  flow_action_validator = EnumAttributeValidator.new('String', ["navigate", "data_exchange"])
  return false unless flow_action_validator.valid?(@flow_action)
  return false if !@flow_token.nil? && @flow_token.to_s.length > 200
  return false if @body.nil?
  true
end