class Glass::Subscription::Notification

Attributes

collection[RW]

The collection that generated the notification.

itemId[RW]

The ID of the item that generated the notification.

operation[RW]

The type of operation that generated the notification.

userActions[RW]

A list of actions taken by the user that triggered the notification.

userToken[RW]

The user token provided by the service when it subscribed for notifications.

verifyToken[RW]

The secret verify token provided by the service when it subscribed for notifications.

Public Instance Methods

delete(mirror=@mirror) click to toggle source

Delete a subscription to a collection.

@param [Google::APIClient] client

Authorized client instance.

@return nil

# File lib/glass/subscriptions/subscription.rb, line 209
def delete(mirror=@mirror)
  result = client.execute(
      :api_method => mirror.subscriptions.delete,
      :parameters => { 'id' => collection })
  if result.error?
    puts "An error occurred: #{result.data['error']['message']}"
  end
end
insert(mirror=@mirror) click to toggle source

Subscribe to notifications for the current user.

@param [Google::APIClient] Mirror

Authorized client instance.

@return nil

# File lib/glass/subscriptions/subscription.rb, line 193
def insert(mirror=@mirror)
  subscription = mirror.subscriptions.insert.request_schema.new(to_json)
  result = client.execute(
      :api_method => mirror.subscriptions.insert,
      :body_object => subscription)
  if result.error?
    puts "An error occurred: #{result.data['error']['message']}"
  end
end