Class: WhatsAppCloudApi::RegisterPhoneRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/whats_app_cloud_api/models/register_phone_request.rb

Overview

RegisterPhoneRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(messaging_product = nil, pin = nil) ⇒ RegisterPhoneRequest

Returns a new instance of RegisterPhoneRequest.



38
39
40
41
42
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 38

def initialize(messaging_product = nil,
               pin = nil)
  @messaging_product = messaging_product unless messaging_product == SKIP
  @pin = pin unless pin == SKIP
end

Instance Attribute Details

#messaging_productString

Messaging service used. In this case, use “whatsapp”.

Returns:

  • (String)


14
15
16
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 14

def messaging_product
  @messaging_product
end

#pinString

A 6-digit pin you have previously set up - See Set Two-Step Verification.

Returns:

  • (String)


18
19
20
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 18

def pin
  @pin
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 45

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  messaging_product =
    hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
  pin = hash.key?('pin') ? hash['pin'] : SKIP

  # Create object from extracted values.
  RegisterPhoneRequest.new(messaging_product,
                           pin)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['messaging_product'] = 'messaging_product'
  @_hash['pin'] = 'pin'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



34
35
36
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 34

def nullables
  []
end

#optionalsObject

An array for optional fields



29
30
31
# File 'lib/whats_app_cloud_api/models/register_phone_request.rb', line 29

def optionals
  []
end