Class: WhatsAppCloudApi::BusinessProfile
- Defined in:
- lib/whats_app_cloud_api/models/business_profile.rb
Overview
BusinessProfile Model.
Instance Attribute Summary collapse
-
#address ⇒ String
Address of the business.
-
#description ⇒ String
Description of the business.
-
#email ⇒ String
The contact email address (in valid email format) of the business.
-
#id ⇒ String
ID of the business profile object.
-
#messaging_product ⇒ String
The messaging service used for the request.
-
#profile_picture_url ⇒ String
URL of the profile picture generated from a call to the Resumable Upload API.
-
#vertical ⇒ VerticalEnum
Industry of the business.
-
#websites ⇒ List of String
The URLs associated with the business.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(id = nil, messaging_product = nil, address = nil, description = nil, vertical = nil, email = nil, websites = nil, profile_picture_url = nil) ⇒ BusinessProfile
constructor
A new instance of BusinessProfile.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
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
#address ⇒ String
Address of the business.
23 24 25 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 23 def address @address end |
#description ⇒ String
Description of the business.
27 28 29 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 27 def description @description end |
#email ⇒ String
The contact email address (in valid email format) of the business.
36 37 38 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 36 def email @email end |
#id ⇒ String
ID of the business profile object.
14 15 16 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 14 def id @id end |
#messaging_product ⇒ String
The messaging service used for the request. Always set it to “whatsapp” if you are using the WhatsApp Business API.
19 20 21 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 19 def messaging_product @messaging_product end |
#profile_picture_url ⇒ String
URL of the profile picture generated from a call to the Resumable Upload API.
47 48 49 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 47 def profile_picture_url @profile_picture_url end |
#vertical ⇒ VerticalEnum
Industry of the business. This can be either an empty string or one of the accepted values.
32 33 34 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 32 def vertical @vertical end |
#websites ⇒ List 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.
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 |
.names ⇒ Object
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
#nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/whats_app_cloud_api/models/business_profile.rb', line 74 def nullables [] end |
#optionals ⇒ Object
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 |