Class: Zernio::InitiateWhatsAppCallRequest

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



103
104
105
106
107
108
109
110
111
112
113
114
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
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 103

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#actionObject

Omit to place a call. Set to send the consent prompt instead.



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

def action
  @action
end

#biz_opaque_callback_dataObject

Accepted for forward compatibility. Not currently echoed back in webhook payloads (SIP-first flow does not pass through Meta's Graph API where Meta would echo this).



35
36
37
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 35

def biz_opaque_callback_data
  @biz_opaque_callback_data
end

#body_textObject

Body text shown with the consent prompt (send_call_permission_request only).



27
28
29
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 27

def body_text
  @body_text
end

#forward_toObject

Per-call destination override. Same accepted shape as the number's stored forwardTo (tel:+E164, sip:..., wss://...).



30
31
32
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 30

def forward_to
  @forward_to
end

#record_overrideObject

Returns the value of attribute record_override.



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

def record_override
  @record_override
end

#toObject

Consumer wa_id (E.164, leading + optional)



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

def to
  @to
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



73
74
75
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 73

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



78
79
80
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 78

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 60

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'to' => :'to',
    :'action' => :'action',
    :'body_text' => :'bodyText',
    :'forward_to' => :'forwardTo',
    :'record_override' => :'recordOverride',
    :'biz_opaque_callback_data' => :'biz_opaque_callback_data'
  }
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



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 274

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



96
97
98
99
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 96

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

.openapi_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 83

def self.openapi_types
  {
    :'account_id' => :'String',
    :'to' => :'String',
    :'action' => :'String',
    :'body_text' => :'String',
    :'forward_to' => :'String',
    :'record_override' => :'Boolean',
    :'biz_opaque_callback_data' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



247
248
249
250
251
252
253
254
255
256
257
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 247

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      to == o.to &&
      action == o.action &&
      body_text == o.body_text &&
      forward_to == o.forward_to &&
      record_override == o.record_override &&
      biz_opaque_callback_data == o.biz_opaque_callback_data
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


261
262
263
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 261

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



267
268
269
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 267

def hash
  [, to, action, body_text, forward_to, record_override, biz_opaque_callback_data].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 152

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 !@body_text.nil? && @body_text.to_s.length > 1024
    invalid_properties.push('invalid value for "body_text", the character length must be smaller than or equal to 1024.')
  end

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 296

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



176
177
178
179
180
181
182
183
184
185
# File 'lib/zernio-sdk/models/initiate_whats_app_call_request.rb', line 176

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @account_id.nil?
  return false if @to.nil?
  action_validator = EnumAttributeValidator.new('String', ["send_call_permission_request"])
  return false unless action_validator.valid?(@action)
  return false if !@body_text.nil? && @body_text.to_s.length > 1024
  return false if !@biz_opaque_callback_data.nil? && @biz_opaque_callback_data.to_s.length > 512
  true
end