Class: HornOfPlenty::Adapters::Github::Parsers::PullRequest

Inherits:
Issue
  • Object
show all
Defined in:
lib/horn_of_plenty/adapters/github/parsers/pull_request.rb

Instance Attribute Summary

Attributes inherited from Issue

#raw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Issue

#assignee_ids, #author_id, #closed_at, #closer_id, #created_at, #description, #has_pull_request?, #id, #initialize, #repository, #title, #updated_at

Constructor Details

This class inherits a constructor from HornOfPlenty::Adapters::Github::Parsers::Issue

Class Method Details

.to_model(raw_item) ⇒ Object



29
30
31
32
33
# File 'lib/horn_of_plenty/adapters/github/parsers/pull_request.rb', line 29

def self.to_model(raw_item)
  return NullObjects::PullRequest.instance unless raw_item

  Models::PullRequest.from_parser(parser: new(raw: raw_item))
end

Instance Method Details

#labelsObject



12
13
14
# File 'lib/horn_of_plenty/adapters/github/parsers/pull_request.rb', line 12

def labels
  []
end

#merger_idObject



16
17
18
# File 'lib/horn_of_plenty/adapters/github/parsers/pull_request.rb', line 16

def merger_id
  @merger_id                             ||= parse_text(raw, 'merged_by/:/login')
end

#statusObject



20
21
22
23
24
25
26
27
# File 'lib/horn_of_plenty/adapters/github/parsers/pull_request.rb', line 20

def status
  @status                                ||= begin
    status    = parse_text(raw, 'state')
    merged_at = parse_text(raw, 'merged_at')

    merged_at ? 'merged' : status
  end
end