Class: GrowlGithubFeed::Event
- Inherits:
-
Object
- Object
- GrowlGithubFeed::Event
- Defined in:
- lib/growl-github-feed/event.rb
Instance Method Summary collapse
- #comment_body ⇒ Object
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(content_hash) ⇒ Event
constructor
A new instance of Event.
- #repo_id ⇒ Object
- #repo_name ⇒ Object
- #type ⇒ Object
- #user ⇒ Object
- #user_avatar_id ⇒ Object
Constructor Details
#initialize(content_hash) ⇒ Event
Returns a new instance of Event.
6 7 8 |
# File 'lib/growl-github-feed/event.rb', line 6 def initialize(content_hash) @content_hash = content_hash end |
Instance Method Details
#comment_body ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/growl-github-feed/event.rb', line 38 def comment_body h = content_hash.attrs return nil unless h.key? :payload h = h[:payload].attrs return nil unless h.key? :comment h = h[:comment].attrs h[:body] end |
#created_at ⇒ Object
14 15 16 |
# File 'lib/growl-github-feed/event.rb', line 14 def created_at content_hash[:created_at].getlocal end |
#id ⇒ Object
10 11 12 |
# File 'lib/growl-github-feed/event.rb', line 10 def id content_hash[:id] end |
#repo_id ⇒ Object
22 23 24 |
# File 'lib/growl-github-feed/event.rb', line 22 def repo_id repo_part[:id] end |
#repo_name ⇒ Object
26 27 28 |
# File 'lib/growl-github-feed/event.rb', line 26 def repo_name repo_part[:name] end |
#type ⇒ Object
18 19 20 |
# File 'lib/growl-github-feed/event.rb', line 18 def type content_hash[:type] end |
#user ⇒ Object
30 31 32 |
# File 'lib/growl-github-feed/event.rb', line 30 def user content_hash[:actor][:login] end |
#user_avatar_id ⇒ Object
34 35 36 |
# File 'lib/growl-github-feed/event.rb', line 34 def user_avatar_id content_hash[:actor][:gravatar_id] end |