Class: Notificon::Notification
- Inherits:
-
Object
- Object
- Notificon::Notification
- Defined in:
- lib/notificon/notification.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#actor ⇒ Object
Returns the value of attribute actor.
-
#id ⇒ Object
Returns the value of attribute id.
-
#item_id ⇒ Object
Returns the value of attribute item_id.
-
#item_text ⇒ Object
Returns the value of attribute item_text.
-
#item_url ⇒ Object
Returns the value of attribute item_url.
-
#occured_at ⇒ Object
Returns the value of attribute occured_at.
-
#read_at ⇒ Object
Returns the value of attribute read_at.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#_id=(value) ⇒ Object
provided to enable simple creation from mongo hash objects.
-
#initialize(attrs = {}) ⇒ Notification
constructor
A new instance of Notification.
- #read? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Notification
Returns a new instance of Notification.
9 10 11 |
# File 'lib/notificon/notification.rb', line 9 def initialize(attrs={}) attrs.each_pair do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def action @action end |
#actor ⇒ Object
Returns the value of attribute actor.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def actor @actor end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def id @id end |
#item_id ⇒ Object
Returns the value of attribute item_id.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def item_id @item_id end |
#item_text ⇒ Object
Returns the value of attribute item_text.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def item_text @item_text end |
#item_url ⇒ Object
Returns the value of attribute item_url.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def item_url @item_url end |
#occured_at ⇒ Object
Returns the value of attribute occured_at.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def occured_at @occured_at end |
#read_at ⇒ Object
Returns the value of attribute read_at.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def read_at @read_at end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/notificon/notification.rb', line 7 def username @username end |
Instance Method Details
#_id=(value) ⇒ Object
provided to enable simple creation from mongo hash objects
14 15 16 |
# File 'lib/notificon/notification.rb', line 14 def _id=(value) @id = value.to_s end |
#read? ⇒ Boolean
18 19 20 |
# File 'lib/notificon/notification.rb', line 18 def read? !read_at.nil? end |
#url ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/notificon/notification.rb', line 22 def url uri = Addressable::URI.parse(item_url) params = {Notificon.notification_id_param => id} if item_id params[Notificon.notification_item_id_param] = item_id params[Notificon.notification_username_param] = username end uri.query_values = (uri.query_values || {}).merge(params) uri.to_s end |