Class: Google::Apis::ChatV1::GoogleAppsCardV1Card

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/chat_v1/classes.rb,
lib/google/apis/chat_v1/representations.rb,
lib/google/apis/chat_v1/representations.rb

Overview

Cards support a defined layout, interactive UI elements like buttons, and rich media like images. Use cards to present detailed information, gather information from users, and guide users to take a next step. In Google Chat, cards appear in several places: - As stand-alone messages. - Accompanying a text message, just beneath the text message. - As a dialog. The following example JSON creates a "contact card" that features: - A header with the contact's name, job title, avatar picture. - A section with the contact information, including formatted text. - Buttons that users can click to share the contact or see more or less info. Example contact card ` "cardsV2": [ ` "cardId": "unique-card-id", "card": ` "header": ` "title" : "Sasha", "subtitle": "Software Engineer", "imageUrl": "https://developers. google.com/chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", " imageAltText": "Avatar for Sasha", `, "sections": [ ` "header": "Contact Info", "collapsible": true, "uncollapsibleWidgetsCount": 1, "widgets": [ ` " decoratedText": ` "startIcon": ` "knownIcon": "EMAIL", `, "text": "sasha@ example.com", ` `, ` "decoratedText": ` "startIcon": ` "knownIcon": "PERSON", ` , "text": "Online", `, `, ` "decoratedText": ` "startIcon": ` "knownIcon": " PHONE", `, "text": "+1 (555) 555-1234", ` `, ` "buttonList": ` "buttons": [ ` " text": "Share", "onClick": ` "openLink": ` "url": "https://example.com/share", ` ` `, ` "text": "Edit", "onClick": ` "action": ` "function": "goToView", " parameters": [ ` "key": "viewType", "value": "EDIT", ` ], ` ` `, ], ` `, ], `, ], `, ` ], `

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleAppsCardV1Card

Returns a new instance of GoogleAppsCardV1Card.



1248
1249
1250
# File 'lib/google/apis/chat_v1/classes.rb', line 1248

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#card_actionsArray<Google::Apis::ChatV1::GoogleAppsCardV1CardAction>

The card's actions. Actions are added to the card's generated toolbar menu. Not supported by Google Chat apps. For example, the following JSON constructs a card action menu with Settings and Send Feedback options: "card_actions": [ ` "actionLabel": "Settings", "onClick": ` "action": ` "functionName": " goToView", "parameters": [ ` "key": "viewType", "value": "SETTING" ` ], " loadIndicator": "LoadIndicator.SPINNER" ` ` `, ` "actionLabel": "Send Feedback" , "onClick": ` "openLink": ` "url": "https://example.com/feedback" ` ` ` ] Corresponds to the JSON property cardActions



1216
1217
1218
# File 'lib/google/apis/chat_v1/classes.rb', line 1216

def card_actions
  @card_actions
end

#display_styleString

The peekCardHeader display style for. Not supported by Google Chat apps. Corresponds to the JSON property displayStyle

Returns:

  • (String)


1221
1222
1223
# File 'lib/google/apis/chat_v1/classes.rb', line 1221

def display_style
  @display_style
end

A persistent (sticky) footer that is added to the bottom of the card. Corresponds to the JSON property fixedFooter



1226
1227
1228
# File 'lib/google/apis/chat_v1/classes.rb', line 1226

def fixed_footer
  @fixed_footer
end

#headerGoogle::Apis::ChatV1::GoogleAppsCardV1CardHeader

Represents a card header. Corresponds to the JSON property header



1231
1232
1233
# File 'lib/google/apis/chat_v1/classes.rb', line 1231

def header
  @header
end

#nameString

Name of the card. Used as a card identifier in card navigation. Corresponds to the JSON property name

Returns:

  • (String)


1236
1237
1238
# File 'lib/google/apis/chat_v1/classes.rb', line 1236

def name
  @name
end

#peek_card_headerGoogle::Apis::ChatV1::GoogleAppsCardV1CardHeader

Represents a card header. Corresponds to the JSON property peekCardHeader



1241
1242
1243
# File 'lib/google/apis/chat_v1/classes.rb', line 1241

def peek_card_header
  @peek_card_header
end

#sectionsArray<Google::Apis::ChatV1::GoogleAppsCardV1Section>

Sections are separated by a line divider. Corresponds to the JSON property sections



1246
1247
1248
# File 'lib/google/apis/chat_v1/classes.rb', line 1246

def sections
  @sections
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1253
1254
1255
1256
1257
1258
1259
1260
1261
# File 'lib/google/apis/chat_v1/classes.rb', line 1253

def update!(**args)
  @card_actions = args[:card_actions] if args.key?(:card_actions)
  @display_style = args[:display_style] if args.key?(:display_style)
  @fixed_footer = args[:fixed_footer] if args.key?(:fixed_footer)
  @header = args[:header] if args.key?(:header)
  @name = args[:name] if args.key?(:name)
  @peek_card_header = args[:peek_card_header] if args.key?(:peek_card_header)
  @sections = args[:sections] if args.key?(:sections)
end