Class: Sendly::WhatsAppWindow

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

Overview

Whether a 24-hour customer-service window is open between one of your WhatsApp senders and a recipient. expires_at is when the window closes (ISO 8601), nil when no window is open.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ WhatsAppWindow

Returns a new instance of WhatsAppWindow.



210
211
212
213
# File 'lib/sendly/whatsapp_resource.rb', line 210

def initialize(data)
  @open = data["open"] || false
  @expires_at = data["expiresAt"] || data["expires_at"]
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



208
209
210
# File 'lib/sendly/whatsapp_resource.rb', line 208

def expires_at
  @expires_at
end

#openObject (readonly)

Returns the value of attribute open.



208
209
210
# File 'lib/sendly/whatsapp_resource.rb', line 208

def open
  @open
end

Instance Method Details

#open?Boolean

Returns:

  • (Boolean)


215
216
217
# File 'lib/sendly/whatsapp_resource.rb', line 215

def open?
  open
end

#to_hObject



219
220
221
# File 'lib/sendly/whatsapp_resource.rb', line 219

def to_h
  { open: open, expires_at: expires_at }.compact
end