Class: HornOfPlenty::Adapters::Github::Parsers::Board

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:) ⇒ Board



15
16
17
# File 'lib/horn_of_plenty/adapters/github/parsers/board.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/board.rb', line 13

def raw
  @raw
end

Class Method Details

.to_model(raw_item) ⇒ Object



43
44
45
46
47
# File 'lib/horn_of_plenty/adapters/github/parsers/board.rb', line 43

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

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

Instance Method Details

#author_idObject



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

def author_id
  @author_id                             ||= parse_text(raw, 'creator/:/login')
end

#created_atObject



35
36
37
# File 'lib/horn_of_plenty/adapters/github/parsers/board.rb', line 35

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

#descriptionObject



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

def description
  @description                           ||= parse_text(raw, 'body')
end

#idObject



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

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

#titleObject



27
28
29
# File 'lib/horn_of_plenty/adapters/github/parsers/board.rb', line 27

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

#updated_atObject



39
40
41
# File 'lib/horn_of_plenty/adapters/github/parsers/board.rb', line 39

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