Class: GitHubEventWatcher::Event

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

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Event

Returns a new instance of Event.



18
19
20
21
# File 'lib/github-event-watcher/event.rb', line 18

def initialize(data)
  @data = data
  @repository = @data["repo"]
end

Instance Method Details

#idObject



23
24
25
# File 'lib/github-event-watcher/event.rb', line 23

def id
  Integer(@data["id"])
end

#payloadObject



31
32
33
# File 'lib/github-event-watcher/event.rb', line 31

def payload
  @data["payload"]
end

#repository_full_nameObject



51
52
53
# File 'lib/github-event-watcher/event.rb', line 51

def repository_full_name
  @repository["name"]
end

#repository_nameObject



45
46
47
48
49
# File 'lib/github-event-watcher/event.rb', line 45

def repository_name
  owner, name = repository_full_name.split("/", 2)
  _ = owner # For suppressing a warning
  name
end

#repository_ownerObject



39
40
41
42
43
# File 'lib/github-event-watcher/event.rb', line 39

def repository_owner
  owner, name = repository_full_name.split("/", 2)
  _ = name # For suppressing a warning
  owner
end

#repository_urlObject



35
36
37
# File 'lib/github-event-watcher/event.rb', line 35

def repository_url
  "https://github.com/#{repository_full_name}"
end

#typeObject



27
28
29
# File 'lib/github-event-watcher/event.rb', line 27

def type
  @data["type"]
end