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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleAppsCardV1Card

Returns a new instance of GoogleAppsCardV1Card.



2094
2095
2096
# File 'lib/google/apis/chat_v1/classes.rb', line 2094

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



2031
2032
2033
# File 'lib/google/apis/chat_v1/classes.rb', line 2031

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)


2038
2039
2040
# File 'lib/google/apis/chat_v1/classes.rb', line 2038

def display_style
  @display_style
end

#expression_dataArray<Google::Apis::ChatV1::GoogleAppsCardV1ExpressionData>

The expression data for the card. Available for Google Workspace add-ons that extend Google Workspace Studio. Unavailable for Google Chat apps. Corresponds to the JSON property expressionData



2044
2045
2046
# File 'lib/google/apis/chat_v1/classes.rb', line 2044

def expression_data
  @expression_data
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



2057
2058
2059
# File 'lib/google/apis/chat_v1/classes.rb', line 2057

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



2065
2066
2067
# File 'lib/google/apis/chat_v1/classes.rb', line 2065

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)


2071
2072
2073
# File 'lib/google/apis/chat_v1/classes.rb', line 2071

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



2079
2080
2081
# File 'lib/google/apis/chat_v1/classes.rb', line 2079

def peek_card_header
  @peek_card_header
end

#section_divider_styleString

The divider style between the header, sections and footer. Corresponds to the JSON property sectionDividerStyle

Returns:

  • (String)


2084
2085
2086
# File 'lib/google/apis/chat_v1/classes.rb', line 2084

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



2092
2093
2094
# File 'lib/google/apis/chat_v1/classes.rb', line 2092

def sections
  @sections
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
# File 'lib/google/apis/chat_v1/classes.rb', line 2099

def update!(**args)
  @card_actions = args[:card_actions] if args.key?(:card_actions)
  @display_style = args[:display_style] if args.key?(:display_style)
  @expression_data = args[:expression_data] if args.key?(:expression_data)
  @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