Module: Octospy::Parser::User

Included in:
Octospy::Parser
Defined in:
lib/octospy/parser/user.rb

Instance Method Summary collapse

Instance Method Details

#parse_follow_eventObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/octospy/parser/user.rb', line 20

def parse_follow_event
  user = @event.payload.target

  title = user.
  title = "#{title} (#{user.name})" if user.name && user.name != ''
  profile = ["#{'repos'.colorize_for_irc.silver}: #{user.public_repos}"]
  profile << "#{'followers'.colorize_for_irc.silver}: #{user.followers}"
  profile << "#{'following'.colorize_for_irc.silver}: #{user.following}"
  profile << "#{'location'.colorize_for_irc.silver}: #{user.location && user.location != '' ? user.location : '-'}"
  profile << "#{'company'.colorize_for_irc.silver}: #{user.company && user.company != '' ? user.company : '-'}"
  profile << "#{'bio'.colorize_for_irc.silver}: #{user.bio && user.bio != '' ? user.bio : '-'}"
  profile << "#{'blog'.colorize_for_irc.silver}: #{user.blog && user.blog != '' ? user.blog : '-'}"

  {
    status: "followed",
    title: title,
    body: profile.join(', '),
    link: "#{Octokit.web_endpoint}#{user.}",
    repository: nil,
    notice: true
  }
end

#parse_watch_eventObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/octospy/parser/user.rb', line 4

def parse_watch_event
  # This is not watch event, this is star event
  # {
  #   status: "#{@event.payload.action} to watch",
  #   title: nil,
  #   link: "#{Octokit.web_endpoint}#{@event.repo.name}/watchers",
  #   repository: @event.repo.name
  # }
  {
    status: 'starred',
    title: nil,
    link: "#{Octokit.web_endpoint}#{@event.repo.name}/stargazers",
    repository: @event.repo.name
  }
end