Class: GSGraph::Notification
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#from ⇒ Object
Returns the value of attribute from.
-
#link ⇒ Object
Returns the value of attribute link.
-
#message ⇒ Object
Returns the value of attribute message.
-
#title ⇒ Object
Returns the value of attribute title.
-
#to ⇒ Object
Returns the value of attribute to.
-
#unread ⇒ Object
Returns the value of attribute unread.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ Notification
constructor
A new instance of Notification.
- #read!(options = {}) ⇒ Object
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Notification
Returns a new instance of Notification.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gs_graph/notification.rb', line 5 def initialize(identifier, attributes = {}) super @title = attributes[:title] @message = attributes[:message] @link = attributes[:link] @unread = attributes[:unread] == 1 if (application = attributes[:application]) @application = Application.new(application[:id], application) end if (from = attributes[:from]) @from = User.new(from[:id], from) end if (to = attributes[:to]) @to = User.new(to[:id], to) end if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end if attributes[:updated_time] @updated_time = Time.parse(attributes[:updated_time]).utc end end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def application @application end |
#created_time ⇒ Object
Returns the value of attribute created_time.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def created_time @created_time end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def from @from end |
#link ⇒ Object
Returns the value of attribute link.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def link @link end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def @message end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def title @title end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def to @to end |
#unread ⇒ Object
Returns the value of attribute unread.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def unread @unread end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
3 4 5 |
# File 'lib/gs_graph/notification.rb', line 3 def updated_time @updated_time end |
Instance Method Details
#read!(options = {}) ⇒ Object
28 29 30 |
# File 'lib/gs_graph/notification.rb', line 28 def read!( = {}) post .merge(:unread => false) end |