Class: WhatsAppCloudApi::BusinessProfile

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

Overview

BusinessProfile Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, messaging_product = nil, address = nil, description = nil, vertical = nil, email = nil, websites = nil, profile_picture_url = nil) ⇒ BusinessProfile

Returns a new instance of BusinessProfile.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 78

def initialize(id = nil,
               messaging_product = nil,
               address = nil,
               description = nil,
               vertical = nil,
               email = nil,
               websites = nil,
               profile_picture_url = nil)
  @id = id unless id == SKIP
  @messaging_product = messaging_product unless messaging_product == SKIP
  @address = address unless address == SKIP
  @description = description unless description == SKIP
  @vertical = vertical unless vertical == SKIP
  @email = email unless email == SKIP
  @websites = websites unless websites == SKIP
  @profile_picture_url = profile_picture_url unless profile_picture_url == SKIP
end

Instance Attribute Details

#addressString

Address of the business.

Returns:

  • (String)


23
24
25
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 23

def address
  @address
end

#descriptionString

Description of the business.

Returns:

  • (String)


27
28
29
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 27

def description
  @description
end

#emailString

The contact email address (in valid email format) of the business.

Returns:

  • (String)


36
37
38
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 36

def email
  @email
end

#idString

ID of the business profile object.

Returns:

  • (String)


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

def id
  @id
end

#messaging_productString

The messaging service used for the request. Always set it to “whatsapp” if you are using the WhatsApp Business API.

Returns:

  • (String)


19
20
21
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 19

def messaging_product
  @messaging_product
end

#profile_picture_urlString

URL of the profile picture generated from a call to the Resumable Upload API.

Returns:

  • (String)


47
48
49
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 47

def profile_picture_url
  @profile_picture_url
end

#verticalVerticalEnum

Industry of the business. This can be either an empty string or one of the accepted values.

Returns:



32
33
34
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 32

def vertical
  @vertical
end

#websitesList of String

The URLs associated with the business. For instance, a website, Facebook Page, or Instagram. You must include the http:// or https:// portion of the URL.

Returns:

  • (List of String)


42
43
44
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 42

def websites
  @websites
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  messaging_product =
    hash.key?('messaging_product') ? hash['messaging_product'] : SKIP
  address = hash.key?('address') ? hash['address'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  vertical = hash.key?('vertical') ? hash['vertical'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  websites = hash.key?('websites') ? hash['websites'] : SKIP
  profile_picture_url =
    hash.key?('profile_picture_url') ? hash['profile_picture_url'] : SKIP

  # Create object from extracted values.
  BusinessProfile.new(id,
                      messaging_product,
                      address,
                      description,
                      vertical,
                      email,
                      websites,
                      profile_picture_url)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['messaging_product'] = 'messaging_product'
  @_hash['address'] = 'address'
  @_hash['description'] = 'description'
  @_hash['vertical'] = 'vertical'
  @_hash['email'] = 'email'
  @_hash['websites'] = 'websites'
  @_hash['profile_picture_url'] = 'profile_picture_url'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



74
75
76
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 74

def nullables
  []
end

#optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 64

def optionals
  %w[
    vertical
    email
    websites
    profile_picture_url
  ]
end