Class: HornOfPlenty::Adapters::Github::Parsers::Lane

Inherits:
Object
  • Object
show all
Includes:
Parsers::Hash
Defined in:
lib/horn_of_plenty/adapters/github/parsers/lane.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:) ⇒ Lane

Returns a new instance of Lane.



15
16
17
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 15

def initialize(raw:)
  self.raw = raw
end

Instance Attribute Details

#rawObject

Returns the value of attribute raw.



13
14
15
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 13

def raw
  @raw
end

Class Method Details

.to_model(raw_item) ⇒ Object



41
42
43
44
45
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 41

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

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

Instance Method Details

#board_idObject



23
24
25
26
27
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 23

def board_id
  @board_id                              ||= parse_text(raw, 'project_url') do |url|
    url.match(%r{\A.*/(\d+)\z})[1]
  end
end

#created_atObject



33
34
35
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 33

def created_at
  @created_at                            ||= parse_time(raw, 'created_at')
end

#idObject



19
20
21
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 19

def id
  @id                                    ||= parse_text(raw, 'id')
end

#titleObject



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

def title
  @title                                 ||= parse_text(raw, 'name')
end

#updated_atObject



37
38
39
# File 'lib/horn_of_plenty/adapters/github/parsers/lane.rb', line 37

def updated_at
  @updated_at                            ||= parse_time(raw, 'updated_at')
end