class FamilyappSdk::Components::Element

Attributes

buttons[RW]
image[RW]
payload[RW]
subtitle[RW]
title[RW]
url[RW]

Public Class Methods

new(title:, subtitle: nil, image: nil, url: nil, payload: nil, buttons: nil) click to toggle source
# File lib/familyapp_sdk/components/element.rb, line 6
def initialize(title:, subtitle: nil, image: nil, url: nil, payload: nil, buttons: nil)
  @title = title
  @subtitle = subtitle
  @image = image
  @url = url
  @payload = payload
  @buttons_attributes = build_attributes(buttons)
end

Public Instance Methods

build() click to toggle source
# File lib/familyapp_sdk/components/element.rb, line 15
def build
  instance_values.delete_if { |_attribute, value| value.nil? }
end
build_attributes(attributes) click to toggle source
# File lib/familyapp_sdk/components/element.rb, line 19
def build_attributes(attributes)
  attributes.map(&:build) if attributes.present?
end