Class: GrowlGithubFeed::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/growl-github-feed/event.rb

Instance Method Summary collapse

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_bodyObject



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_atObject



14
15
16
# File 'lib/growl-github-feed/event.rb', line 14

def created_at
  content_hash[:created_at].getlocal
end

#idObject



10
11
12
# File 'lib/growl-github-feed/event.rb', line 10

def id
  content_hash[:id]
end

#repo_idObject



22
23
24
# File 'lib/growl-github-feed/event.rb', line 22

def repo_id
  repo_part[:id]
end

#repo_nameObject



26
27
28
# File 'lib/growl-github-feed/event.rb', line 26

def repo_name
  repo_part[:name]
end

#typeObject



18
19
20
# File 'lib/growl-github-feed/event.rb', line 18

def type
  content_hash[:type]
end

#userObject



30
31
32
# File 'lib/growl-github-feed/event.rb', line 30

def user
  content_hash[:actor][:login]
end

#user_avatar_idObject



34
35
36
# File 'lib/growl-github-feed/event.rb', line 34

def user_avatar_id
  content_hash[:actor][:gravatar_id]
end