Class: Glass::Subscription::Notification
- Inherits:
-
Object
- Object
- Glass::Subscription::Notification
- Defined in:
- lib/glass/subscriptions/subscription.rb
Defined Under Namespace
Classes: Action
Instance Attribute Summary collapse
-
#collection ⇒ Object
The collection that generated the notification.
-
#itemId ⇒ Object
The ID of the item that generated the notification.
-
#operation ⇒ Object
The type of operation that generated the notification.
-
#userActions ⇒ Object
A list of actions taken by the user that triggered the notification.
-
#userToken ⇒ Object
The user token provided by the service when it subscribed for notifications.
-
#verifyToken ⇒ Object
The secret verify token provided by the service when it subscribed for notifications.
Instance Method Summary collapse
-
#delete(mirror = @mirror) ⇒ Object
Delete a subscription to a collection.
-
#insert(mirror = @mirror) ⇒ Object
Subscribe to notifications for the current user.
Instance Attribute Details
#collection ⇒ Object
The collection that generated the notification.
127 128 129 |
# File 'lib/glass/subscriptions/subscription.rb', line 127 def collection @collection end |
#itemId ⇒ Object
The ID of the item that generated the notification.
132 133 134 |
# File 'lib/glass/subscriptions/subscription.rb', line 132 def itemId @itemId end |
#operation ⇒ Object
The type of operation that generated the notification.
137 138 139 |
# File 'lib/glass/subscriptions/subscription.rb', line 137 def operation @operation end |
#userActions ⇒ Object
A list of actions taken by the user that triggered the notification.
152 153 154 |
# File 'lib/glass/subscriptions/subscription.rb', line 152 def userActions @userActions end |
#userToken ⇒ Object
The user token provided by the service when it subscribed for notifications.
147 148 149 |
# File 'lib/glass/subscriptions/subscription.rb', line 147 def userToken @userToken end |
#verifyToken ⇒ Object
The secret verify token provided by the service when it subscribed for notifications.
142 143 144 |
# File 'lib/glass/subscriptions/subscription.rb', line 142 def verifyToken @verifyToken end |
Instance Method Details
#delete(mirror = @mirror) ⇒ Object
Delete a subscription to a collection.
209 210 211 212 213 214 215 216 |
# 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) ⇒ Object
Subscribe to notifications for the current user.
193 194 195 196 197 198 199 200 201 |
# 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 |