Class: HornOfPlenty::Adapters::Github::Requests::ListLanes

Inherits:
Request
  • Object
show all
Defined in:
lib/horn_of_plenty/adapters/github/requests/list_lanes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#query_class, #response_class

Constructor Details

#initialize(format: 'raw', pagination: {}, query: {}, repository:) ⇒ ListLanes



14
15
16
17
18
19
20
21
22
23
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 14

def initialize(format:     'raw',
               pagination: {},
               query:      {},
               repository:)

  self.format     = format
  self.pagination = pagination
  self.query      = query
  self.repository = repository
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



9
10
11
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 9

def format
  @format
end

#paginationObject

Returns the value of attribute pagination.



9
10
11
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 9

def pagination
  @pagination
end

#queryObject

Returns the value of attribute query.



9
10
11
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 9

def query
  @query
end

#repositoryObject

Returns the value of attribute repository.



9
10
11
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 9

def repository
  @repository
end

Instance Method Details

#methodObject



25
26
27
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 25

def method
  'get'
end

#pathObject



29
30
31
32
33
34
35
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 29

def path
  if query[:id]
    "repos/#{repository}/projects/columns/#{query[:id]}"
  elsif query[:board_id]
    "repos/#{repository}/projects/#{query[:board_id]}/columns"
  end
end

#to_hObject Also known as: to_params



37
38
39
40
# File 'lib/horn_of_plenty/adapters/github/requests/list_lanes.rb', line 37

def to_h
  @to_h ||= query_class.new(query).to_h.
            merge(pagination_hash)
end