Class: Google::Apis::MirrorV1::MenuItem

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/mirror_v1/classes.rb,
generated/google/apis/mirror_v1/representations.rb,
generated/google/apis/mirror_v1/representations.rb

Overview

A custom menu item that can be presented to the user by a timeline item.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ MenuItem

Returns a new instance of MenuItem.


471
472
473
# File 'generated/google/apis/mirror_v1/classes.rb', line 471

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

Instance Attribute Details

#actionString

Controls the behavior when the user picks the menu option. Allowed values are:

  • CUSTOM - Custom action set by the service. When the user selects this menuItem, the API triggers a notification to your callbackUrl with the userActions.type set to CUSTOM and the userActions.payload set to the ID of this menu item. This is the default value.
  • Built-in actions:
  • REPLY - Initiate a reply to the timeline item using the voice recording UI. The creator attribute must be set in the timeline item for this menu to be available.
  • REPLY_ALL - Same behavior as REPLY. The original timeline item's recipients will be added to the reply item.
  • DELETE - Delete the timeline item.
  • SHARE - Share the timeline item with the available contacts.
  • READ_ALOUD - Read the timeline item's speakableText aloud; if this field is not set, read the text field; if none of those fields are set, this menu item is ignored.
  • GET_MEDIA_INPUT - Allow users to provide media payloads to Glassware from a menu item (currently, only transcribed text from voice input is supported). Subscribe to notifications when users invoke this menu item to receive the timeline item ID. Retrieve the media from the timeline item in the payload property.
  • VOICE_CALL - Initiate a phone call using the timeline item's creator. phoneNumber attribute as recipient.
  • NAVIGATE - Navigate to the timeline item's location.
  • TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
  • OPEN_URI - Open the payload of the menu item in the browser.
  • PLAY_VIDEO - Open the payload of the menu item in the Glass video player.
  • SEND_MESSAGE - Initiate sending a message to the timeline item's creator:
  • If the creator.phoneNumber is set and Glass is connected to an Android phone, the message is an SMS.
  • Otherwise, if the creator.email is set, the message is an email. Corresponds to the JSON property action

Returns:

  • (String)

431
432
433
# File 'generated/google/apis/mirror_v1/classes.rb', line 431

def action
  @action
end

#contextual_commandString

The ContextualMenus.Command associated with this MenuItem (e.g. READ_ALOUD). The voice label for this command will be displayed in the voice menu and the touch label will be displayed in the touch menu. Note that the default menu value's display name will be overriden if you specify this property. Values that do not correspond to a ContextualMenus.Command name will be ignored. Corresponds to the JSON property contextual_command

Returns:

  • (String)

440
441
442
# File 'generated/google/apis/mirror_v1/classes.rb', line 440

def contextual_command
  @contextual_command
end

#idString

The ID for this menu item. This is generated by the application and is treated as an opaque token. Corresponds to the JSON property id

Returns:

  • (String)

446
447
448
# File 'generated/google/apis/mirror_v1/classes.rb', line 446

def id
  @id
end

#payloadString

A generic payload whose meaning changes depending on this MenuItem's action.

  • When the action is OPEN_URI, the payload is the URL of the website to view.
  • When the action is PLAY_VIDEO, the payload is the streaming URL of the video
  • When the action is GET_MEDIA_INPUT, the payload is the text transcription of a user's speech input Corresponds to the JSON property payload

Returns:

  • (String)

455
456
457
# File 'generated/google/apis/mirror_v1/classes.rb', line 455

def payload
  @payload
end

#remove_when_selectedBoolean Also known as: remove_when_selected?

If set to true on a CUSTOM menu item, that item will be removed from the menu after it is selected. Corresponds to the JSON property removeWhenSelected

Returns:

  • (Boolean)

461
462
463
# File 'generated/google/apis/mirror_v1/classes.rb', line 461

def remove_when_selected
  @remove_when_selected
end

#valuesArray<Google::Apis::MirrorV1::MenuValue>

For CUSTOM items, a list of values controlling the appearance of the menu item in each of its states. A value for the DEFAULT state must be provided. If the PENDING or CONFIRMED states are missing, they will not be shown. Corresponds to the JSON property values


469
470
471
# File 'generated/google/apis/mirror_v1/classes.rb', line 469

def values
  @values
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object


476
477
478
479
480
481
482
483
# File 'generated/google/apis/mirror_v1/classes.rb', line 476

def update!(**args)
  @action = args[:action] if args.key?(:action)
  @contextual_command = args[:contextual_command] if args.key?(:contextual_command)
  @id = args[:id] if args.key?(:id)
  @payload = args[:payload] if args.key?(:payload)
  @remove_when_selected = args[:remove_when_selected] if args.key?(:remove_when_selected)
  @values = args[:values] if args.key?(:values)
end