Class: Octogate::Event::Push

Inherits:
Base
  • Object
show all
Defined in:
lib/octogate/events/push.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#initialize

Instance Attribute Details

#afterObject (readonly)

Returns the value of attribute after.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def after
  @after
end

#beforeObject (readonly)

Returns the value of attribute before.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def before
  @before
end

#commitsObject (readonly)

Returns the value of attribute commits.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def commits
  @commits
end

#compareObject (readonly)

Returns the value of attribute compare.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def compare
  @compare
end

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def created
  @created
end

#deletedObject (readonly)

Returns the value of attribute deleted.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def deleted
  @deleted
end

#forcedObject (readonly)

Returns the value of attribute forced.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def forced
  @forced
end

#head_commitObject (readonly)

Returns the value of attribute head_commit.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def head_commit
  @head_commit
end

#pusherObject (readonly)

Returns the value of attribute pusher.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def pusher
  @pusher
end

#refObject (readonly)

Returns the value of attribute ref.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def ref
  @ref
end

#repositoryObject (readonly)

Returns the value of attribute repository.



3
4
5
# File 'lib/octogate/events/push.rb', line 3

def repository
  @repository
end

Class Method Details

.parse(json) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/octogate/events/push.rb', line 5

def parse(json)
  payload = Oj.load(json).deep_symbolize_keys

  commits = payload[:commits].map do |c|
    GH::Commit.new(c.symbolize_keys)
  end

  head_commit = payload[:head_commit] ? GH::Commit.new(payload[:head_commit]) : nil

  repository = GH::Repository.new(payload[:repository])

  new(
    ref: payload[:ref],
    after: payload[:after],
    before: payload[:before],
    created: payload[:created],
    deleted: payload[:deleted],
    forced: payload[:forced],
    compare: payload[:compare],
    commits: commits,
    head_commit: head_commit,
    repository: repository,
  )
end

Instance Method Details

#default_conditionObject



31
32
33
# File 'lib/octogate/events/push.rb', line 31

def default_condition
  !deleted
end