Class: Google::Apis::ChatV1::GoogleAppsCardV1Card
- Inherits:
-
Object
- Object
- Google::Apis::ChatV1::GoogleAppsCardV1Card
- 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, and 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 information.
` "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
-
#card_actions ⇒ Array<Google::Apis::ChatV1::GoogleAppsCardV1CardAction>
The card's actions.
-
#display_style ⇒ String
In Google Workspace add-ons, sets the display properties of the
peekCardHeader. -
#fixed_footer ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardFixedFooter
A persistent (sticky) footer that that appears at the bottom of the card.
-
#header ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardHeader
Represents a card header.
-
#name ⇒ String
Name of the card.
-
#peek_card_header ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardHeader
Represents a card header.
-
#section_divider_style ⇒ String
The divider style between sections.
-
#sections ⇒ Array<Google::Apis::ChatV1::GoogleAppsCardV1Section>
Contains a collection of widgets.
Instance Method Summary collapse
-
#initialize(**args) ⇒ GoogleAppsCardV1Card
constructor
A new instance of GoogleAppsCardV1Card.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ GoogleAppsCardV1Card
Returns a new instance of GoogleAppsCardV1Card.
1438 1439 1440 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1438 def initialize(**args) update!(**args) end |
Instance Attribute Details
#card_actions ⇒ Array<Google::Apis::ChatV1::GoogleAppsCardV1CardAction>
The card's actions. Actions are added to the card's toolbar menu. Because Chat
app cards have no toolbar, cardActions[] isn't supported by 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
1393 1394 1395 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1393 def card_actions @card_actions end |
#display_style ⇒ String
In Google Workspace add-ons, sets the display properties of the
peekCardHeader. Not supported by Chat apps.
Corresponds to the JSON property displayStyle
1399 1400 1401 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1399 def display_style @display_style end |
#fixed_footer ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardFixedFooter
A persistent (sticky) footer that that appears at the bottom of the card.
Setting fixedFooter without specifying a primaryButton or a
secondaryButton causes an error. Supported by Google Workspace Add-ons and
Chat apps. For Chat apps, you can use fixed footers in dialogs, but not card messages.
Corresponds to the JSON property fixedFooter
1409 1410 1411 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1409 def @fixed_footer end |
#header ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardHeader
Represents a card header.
Corresponds to the JSON property header
1414 1415 1416 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1414 def header @header end |
#name ⇒ String
Name of the card. Used as a card identifier in card navigation. Because Chat
apps don't support card navigation, they ignore this field.
Corresponds to the JSON property name
1420 1421 1422 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1420 def name @name end |
#peek_card_header ⇒ Google::Apis::ChatV1::GoogleAppsCardV1CardHeader
Represents a card header.
Corresponds to the JSON property peekCardHeader
1425 1426 1427 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1425 def peek_card_header @peek_card_header end |
#section_divider_style ⇒ String
The divider style between sections.
Corresponds to the JSON property sectionDividerStyle
1430 1431 1432 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1430 def section_divider_style @section_divider_style end |
#sections ⇒ Array<Google::Apis::ChatV1::GoogleAppsCardV1Section>
Contains a collection of widgets. Each section has its own, optional header.
Sections are visually separated by a line divider.
Corresponds to the JSON property sections
1436 1437 1438 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1436 def sections @sections end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 |
# File 'lib/google/apis/chat_v1/classes.rb', line 1443 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) @section_divider_style = args[:section_divider_style] if args.key?(:section_divider_style) @sections = args[:sections] if args.key?(:sections) end |