Class: Google::Apis::ChatV1::CardWithId
- Inherits:
-
Object
- Object
- Google::Apis::ChatV1::CardWithId
- 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
A card in a Google Chat message. Only Chat apps can create cards. If your Chat app authenticates as a user, the message can't contain cards.
Instance Attribute Summary collapse
-
#card ⇒ Google::Apis::ChatV1::GoogleAppsCardV1Card
A card interface displayed in a Google Chat message or Google Workspace Add-on.
-
#card_id ⇒ String
Required if the message contains multiple cards.
Instance Method Summary collapse
-
#initialize(**args) ⇒ CardWithId
constructor
A new instance of CardWithId.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ CardWithId
Returns a new instance of CardWithId.
446 447 448 |
# File 'lib/google/apis/chat_v1/classes.rb', line 446 def initialize(**args) update!(**args) end |
Instance Attribute Details
#card ⇒ Google::Apis::ChatV1::GoogleAppsCardV1Card
A card interface displayed in a Google Chat message or Google Workspace Add-on.
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. To learn how to
build cards, see the following documentation: * For Google Chat apps, see
Design dynamic, interactive, and consistent UIs with cards. * For Google Workspace Add-ons, see Card-based
interfaces.
Example: Card message for a Google Chat app
To create the
sample card message in Google Chat, use the following JSON: ` "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", ` ], ` ` `, ], ` `, ], `, ], `, ` ], `
Corresponds to the JSON property card
438 439 440 |
# File 'lib/google/apis/chat_v1/classes.rb', line 438 def card @card end |
#card_id ⇒ String
Required if the message contains multiple cards. A unique identifier for a
card in a message.
Corresponds to the JSON property cardId
444 445 446 |
# File 'lib/google/apis/chat_v1/classes.rb', line 444 def card_id @card_id end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
451 452 453 454 |
# File 'lib/google/apis/chat_v1/classes.rb', line 451 def update!(**args) @card = args[:card] if args.key?(:card) @card_id = args[:card_id] if args.key?(:card_id) end |