class Pinnacle::Card
def self.from_json(json_object:)
-
(Pinnacle::Card)
-
Parameters:
-
json_object
(String
) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) title = parsed_json["title"] subtitle = parsed_json["subtitle"] media_url = parsed_json["mediaUrl"] buttons = parsed_json["buttons"]&.map do |item| item = item.to_json Pinnacle::Action.from_json(json_object: item) end new( title: title, subtitle: subtitle, media_url: media_url, buttons: buttons, additional_properties: struct ) end
def self.validate_raw(obj:)
-
(Void)
-
Parameters:
-
obj
(Object
) --
def self.validate_raw(obj:) obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.subtitle&.is_a?(String) != false || raise("Passed value for field obj.subtitle is not the expected type, validation failed.") obj.media_url&.is_a?(String) != false || raise("Passed value for field obj.media_url is not the expected type, validation failed.") obj.buttons&.is_a?(Array) != false || raise("Passed value for field obj.buttons is not the expected type, validation failed.") end
def initialize(title:, subtitle: OMIT, media_url: OMIT, buttons: OMIT, additional_properties: nil)
-
(Pinnacle::Card)
-
Parameters:
-
additional_properties
(OpenStruct
) -- Additional properties unmapped to the current class definition -
buttons
(Array
) -- Optional list of buttons on the card (max 4). -
media_url
(String
) -- Optional media URL displayed with the card. -
subtitle
(String
) -- Optional subtitle for the card. -
title
(String
) -- The title of the card.
def initialize(title:, subtitle: OMIT, media_url: OMIT, buttons: OMIT, additional_properties: nil) @title = title @subtitle = subtitle if subtitle != OMIT @media_url = media_url if media_url != OMIT @buttons = buttons if buttons != OMIT @additional_properties = additional_properties @_field_set = { "title": title, "subtitle": subtitle, "mediaUrl": media_url, "buttons": buttons }.reject do |_k, v| v == OMIT end end
def to_json(*_args)
-
(String)
-
def to_json(*_args) @_field_set&.to_json end