Class: Sendly::WhatsAppSenderProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/whatsapp_resource.rb

Overview

A sender's WhatsApp business profile — what recipients see when they open the sender's details in WhatsApp. Unset fields are nil. profile_photo_url is read-only here: the photo cannot be set through Sendly::WhatsAppSendersResource#update_profile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ WhatsAppSenderProfile

Returns a new instance of WhatsAppSenderProfile.



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/sendly/whatsapp_resource.rb', line 117

def initialize(data)
  @phone_number = data["phoneNumber"] || data["phone_number"]
  @display_name = data["displayName"] || data["display_name"]
  @profile_photo_url = data["profilePhotoUrl"] || data["profile_photo_url"]
  @category = data["category"]
  @about = data["about"]
  @description = data["description"]
  @email = data["email"]
  @website = data["website"]
  @address = data["address"]
end

Instance Attribute Details

#aboutObject (readonly)

Returns the value of attribute about.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def about
  @about
end

#addressObject (readonly)

Returns the value of attribute address.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def address
  @address
end

#categoryObject (readonly)

Returns the value of attribute category.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def category
  @category
end

#descriptionObject (readonly)

Returns the value of attribute description.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def description
  @description
end

#display_nameObject (readonly)

Returns the value of attribute display_name.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def display_name
  @display_name
end

#emailObject (readonly)

Returns the value of attribute email.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def email
  @email
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def phone_number
  @phone_number
end

#profile_photo_urlObject (readonly)

Returns the value of attribute profile_photo_url.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def profile_photo_url
  @profile_photo_url
end

#websiteObject (readonly)

Returns the value of attribute website.



114
115
116
# File 'lib/sendly/whatsapp_resource.rb', line 114

def website
  @website
end

Instance Method Details

#to_hObject



129
130
131
132
133
134
135
136
# File 'lib/sendly/whatsapp_resource.rb', line 129

def to_h
  {
    phone_number: phone_number, display_name: display_name,
    profile_photo_url: profile_photo_url, category: category,
    about: about, description: description, email: email,
    website: website, address: address
  }.compact
end