class Messages::MessageAttachment

Attributes

author_icon[RW]
author_name[RW]
color[RW]
image_url[RW]
pretext[RW]
status[RW]
text[RW]
thumb_url[RW]
title[RW]
ts[RW]

Public Class Methods

new() click to toggle source
# File lib/yellowant/message/message_attachment.rb, line 9
def initialize
        @image_url = ''
        @thumb_url = ''
        @color = ''
        @text = ''
        @author_name = ''
        @author_link = ''
        @author_icon = ''
        @footer = ''
        @footer_icon = ''
        @pretext = ''
        @title = ''
        @title_link = ''
        @status = 0
        @ts = 0
        @fields = Array.new
        @buttons = Array.new
end

Public Instance Methods

attach_button(button) click to toggle source
# File lib/yellowant/message/message_attachment.rb, line 36
def attach_button(button)
        if !field.is_a? ButtonClass
                raise YellowantExceptions::YellowAntError, "Attachment must be 'AttachmentClass' class" 
        else
                @button << button.get_dict
        end
end
attach_field(field) click to toggle source
# File lib/yellowant/message/message_attachment.rb, line 28
def attach_field(field)
        if !field.is_a? AttachmentClass
                raise YellowantExceptions::YellowAntError, "Attachment must be 'AttachmentClass' class" 
        else
                @field << field.get_dict
        end
end
get_dict() click to toggle source
# File lib/yellowant/message/message_attachment.rb, line 44
def get_dict
        if !@status.is_a? Integer
                raise YellowantExceptions::YellowAntError, ":status must be an integer"
        elsif !@ts.is_a? Integer 
                raise YellowantExceptions::YellowAntError, ":ts must be an integer"
        end
        {"image_url"=> @image_url, "thumb_url"=> @thumb_url, "color"=> @color, "text"=> @text, "author_name"=> @author_name, 
        "author_icon"=> @author_icon, "author_link"=> @author_link, "ts"=> @ts, "footer"=> @footer, "footer_icon"=> @footer_icon, 
        "pretext"=> @pretext, "title"=> @title, "title_link"=> @title_link, "status"=> @status, "fields"=> @fields,
        "buttons"=> @buttons}
end