Class: Google::Apis::ChatV1::CardWithId

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

A card in a Google Chat message. Chat apps can create cards with app authentication. As part of the Developer Preview Program, if your Chat app authenticates as a user, it can create card messages. If your Chat app is not part of Developer Preview Program, it can't create cards with user authentication. To learn how to create a message that contains cards, see Send a message. Card builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ CardWithId

Returns a new instance of CardWithId.



644
645
646
# File 'lib/google/apis/chat_v1/classes.rb', line 644

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

Instance Attribute Details

#cardGoogle::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. Card builder To learn how to build cards, see the following documentation: * For Google Chat apps, see Design the components of a card or dialog. * For Google Workspace add-ons, see Card- based interfaces. Note: You can add up to 100 widgets per card. If a section's widgets push the total count above 100, that entire section and all following sections are ignored. This limit applies to both card messages and dialogs in Google Chat apps, and to cards in Google Workspace add-ons. Example: Card message for a Google Chat app Example contact card 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/workspace/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



636
637
638
# File 'lib/google/apis/chat_v1/classes.rb', line 636

def card
  @card
end

#card_idString

Required if the message contains multiple cards. A unique identifier for a card in a message. Corresponds to the JSON property cardId

Returns:

  • (String)


642
643
644
# File 'lib/google/apis/chat_v1/classes.rb', line 642

def card_id
  @card_id
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



649
650
651
652
# File 'lib/google/apis/chat_v1/classes.rb', line 649

def update!(**args)
  @card = args[:card] if args.key?(:card)
  @card_id = args[:card_id] if args.key?(:card_id)
end