class GHArchive::Event

Constants

IMPLEMENTATIONS

Public Class Methods

new(json) click to toggle source
# File lib/gh-archive/events.rb, line 14
def initialize(json)
    @json = json.freeze
    @payload = json['payload']
end
parse(json) click to toggle source
# File lib/gh-archive/events.rb, line 6
def self.parse(json)
    IMPLEMENTATIONS.each do |event_class|
        return event_class.new(json) if event_class.fits?(json)
    end
    
    return Event.new(json)
end

Public Instance Methods

actor() click to toggle source
# File lib/gh-archive/events.rb, line 28
def actor
    User.new(@json['actor'])
end
created_at() click to toggle source
# File lib/gh-archive/events.rb, line 23
def created_at
    Time.parse(@json['created_at'])
end
Also aliased as: time
json() click to toggle source
# File lib/gh-archive/events.rb, line 40
def json
    @json
end
public?() click to toggle source
# File lib/gh-archive/events.rb, line 19
def public?
    @json['public']
end
repo() click to toggle source
# File lib/gh-archive/events.rb, line 32
def repo
    Repository.new(
        @json['repo']['id'],
        @json['repo']['name'],
        @json['repo']['url']
    )
end
time()
Alias for: created_at