Class: Zernio::WhatsAppTemplateButton

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
199
200
201
202
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 131

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#autofill_textObject

Returns the value of attribute autofill_text.



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

def autofill_text
  @autofill_text
end

#exampleObject

Returns the value of attribute example.



26
27
28
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 26

def example
  @example
end

#flow_actionObject

Returns the value of attribute flow_action.



46
47
48
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 46

def flow_action
  @flow_action
end

#flow_idObject

Returns the value of attribute flow_id.



40
41
42
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 40

def flow_id
  @flow_id
end

#flow_jsonObject

Returns the value of attribute flow_json.



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

def flow_json
  @flow_json
end

#flow_nameObject

Returns the value of attribute flow_name.



42
43
44
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 42

def flow_name
  @flow_name
end

Returns the value of attribute navigate_screen.



48
49
50
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 48

def navigate_screen
  @navigate_screen
end

#otp_typeObject

Required when type is otp



32
33
34
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 32

def otp_type
  @otp_type
end

#package_nameObject

Returns the value of attribute package_name.



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

def package_name
  @package_name
end

#phone_numberObject

Required when type is phone_number



29
30
31
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 29

def phone_number
  @phone_number
end

#signature_hashObject

Returns the value of attribute signature_hash.



38
39
40
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 38

def signature_hash
  @signature_hash
end

#textObject

Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp).



21
22
23
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 21

def text
  @text
end

#typeObject

Returns the value of attribute type.



18
19
20
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 18

def type
  @type
end

#urlObject

Required when type is URL



24
25
26
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 24

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



93
94
95
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 93

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



98
99
100
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 98

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 73

def self.attribute_map
  {
    :'type' => :'type',
    :'text' => :'text',
    :'url' => :'url',
    :'example' => :'example',
    :'phone_number' => :'phone_number',
    :'otp_type' => :'otp_type',
    :'autofill_text' => :'autofill_text',
    :'package_name' => :'package_name',
    :'signature_hash' => :'signature_hash',
    :'flow_id' => :'flow_id',
    :'flow_name' => :'flow_name',
    :'flow_json' => :'flow_json',
    :'flow_action' => :'flow_action',
    :'navigate_screen' => :'navigate_screen'
  }
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



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 284

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



123
124
125
126
127
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 123

def self.openapi_nullable
  Set.new([
    :'example',
  ])
end

.openapi_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 103

def self.openapi_types
  {
    :'type' => :'String',
    :'text' => :'String',
    :'url' => :'String',
    :'example' => :'Object',
    :'phone_number' => :'String',
    :'otp_type' => :'String',
    :'autofill_text' => :'String',
    :'package_name' => :'String',
    :'signature_hash' => :'String',
    :'flow_id' => :'String',
    :'flow_name' => :'String',
    :'flow_json' => :'String',
    :'flow_action' => :'String',
    :'navigate_screen' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 250

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      type == o.type &&
      text == o.text &&
      url == o.url &&
      example == o.example &&
      phone_number == o.phone_number &&
      otp_type == o.otp_type &&
      autofill_text == o.autofill_text &&
      package_name == o.package_name &&
      signature_hash == o.signature_hash &&
      flow_id == o.flow_id &&
      flow_name == o.flow_name &&
      flow_json == o.flow_json &&
      flow_action == o.flow_action &&
      navigate_screen == o.navigate_screen
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


271
272
273
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 271

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



277
278
279
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 277

def hash
  [type, text, url, example, phone_number, otp_type, autofill_text, package_name, signature_hash, flow_id, flow_name, flow_json, flow_action, navigate_screen].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



206
207
208
209
210
211
212
213
214
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 206

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @type.nil?
    invalid_properties.push('invalid value for "type", type 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



306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 306

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



218
219
220
221
222
223
224
225
226
# File 'lib/zernio-sdk/models/whats_app_template_button.rb', line 218

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number", "otp", "copy_code", "flow", "mpm", "catalog"])
  return false unless type_validator.valid?(@type)
  otp_type_validator = EnumAttributeValidator.new('String', ["copy_code", "one_tap", "zero_tap"])
  return false unless otp_type_validator.valid?(@otp_type)
  true
end