Class: PostProxy::MessageButton

Inherits:
Model
  • Object
show all
Defined in:
lib/postproxy/types.rb

Overview

A button attached to the message, delivered as a Meta generic template. Facebook and Instagram only; up to 3 per send. url is required and must be https when type is "web_url"; payload is required when type is "postback". type is a plain string rather than an enum so a new Meta button type needs no SDK release.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ MessageButton

Returns a new instance of MessageButton.



456
457
458
459
460
# File 'lib/postproxy/types.rb', line 456

def initialize(**attrs)
  @url = nil
  @payload = nil
  super
end

Instance Attribute Details

#payloadObject

Returns the value of attribute payload.



454
455
456
# File 'lib/postproxy/types.rb', line 454

def payload
  @payload
end

#titleObject

Returns the value of attribute title.



454
455
456
# File 'lib/postproxy/types.rb', line 454

def title
  @title
end

#typeObject

Returns the value of attribute type.



454
455
456
# File 'lib/postproxy/types.rb', line 454

def type
  @type
end

#urlObject

Returns the value of attribute url.



454
455
456
# File 'lib/postproxy/types.rb', line 454

def url
  @url
end

Instance Method Details

#to_hObject



462
463
464
# File 'lib/postproxy/types.rb', line 462

def to_h
  { type: @type, title: @title, url: @url, payload: @payload }.compact
end