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

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. 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" ` ] ` ` ` ] ` ` ] ` ] ` ` ] `

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleAppsCardV1Card

Returns a new instance of GoogleAppsCardV1Card.



1607
1608
1609
# File 'lib/google/apis/chat_v1/classes.rb', line 1607

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 toolbar menu. Google Workspace Add-ons: 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



1550
1551
1552
# File 'lib/google/apis/chat_v1/classes.rb', line 1550

def card_actions
  @card_actions
end

#display_styleString

In Google Workspace Add-ons, sets the display properties of the peekCardHeader. Google Workspace Add-ons: Corresponds to the JSON property displayStyle

Returns:

  • (String)


1557
1558
1559
# File 'lib/google/apis/chat_v1/classes.rb', line 1557

def display_style
  @display_style
end

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. For Chat apps, you can use fixed footers in dialogs, but not card messages. For an example in Google Chat apps, see Add a persistent footer. Google Workspace Add-ons and Chat apps: Corresponds to the JSON property fixedFooter



1570
1571
1572
# File 'lib/google/apis/chat_v1/classes.rb', line 1570

def fixed_footer
  @fixed_footer
end

#headerGoogle::Apis::ChatV1::GoogleAppsCardV1CardHeader

Represents a card header. For an example in Google Chat apps, see Add a header. Google Workspace Add-ons and Chat apps: Corresponds to the JSON property header



1578
1579
1580
# File 'lib/google/apis/chat_v1/classes.rb', line 1578

def header
  @header
end

#nameString

Name of the card. Used as a card identifier in card navigation. Google Workspace Add-ons: Corresponds to the JSON property name

Returns:

  • (String)


1584
1585
1586
# File 'lib/google/apis/chat_v1/classes.rb', line 1584

def name
  @name
end

#peek_card_headerGoogle::Apis::ChatV1::GoogleAppsCardV1CardHeader

Represents a card header. For an example in Google Chat apps, see Add a header. Google Workspace Add-ons and Chat apps: Corresponds to the JSON property peekCardHeader



1592
1593
1594
# File 'lib/google/apis/chat_v1/classes.rb', line 1592

def peek_card_header
  @peek_card_header
end

#section_divider_styleString

The divider style between sections. Corresponds to the JSON property sectionDividerStyle

Returns:

  • (String)


1597
1598
1599
# File 'lib/google/apis/chat_v1/classes.rb', line 1597

def section_divider_style
  @section_divider_style
end

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

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Define a section of a card. Corresponds to the JSON property sections



1605
1606
1607
# File 'lib/google/apis/chat_v1/classes.rb', line 1605

def sections
  @sections
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
# File 'lib/google/apis/chat_v1/classes.rb', line 1612

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