class TocaroWebhook::Payload

Attributes

attachments[RW]
color[RW]
text[RW]

Public Instance Methods

add_attachment(options={}) click to toggle source
# File lib/tocaro_webhook/payload.rb, line 24
def add_attachment(options={})
  attachments.add(options)
end
to_body() click to toggle source

uri encode json object

# File lib/tocaro_webhook/payload.rb, line 8
def to_body
  "payload=" + URI.encode(to_json_string)
end
to_h() click to toggle source
# File lib/tocaro_webhook/payload.rb, line 12
def to_h
  { text: text, color: color, attachments: attachments.to_a }
end

Private Instance Methods

to_json_string() click to toggle source
# File lib/tocaro_webhook/payload.rb, line 34
def to_json_string
  to_h.to_json.to_s
end