Class: Geet::Gitlab::Milestone

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/gitlab/milestone.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number, title, due_on, api_interface) ⇒ Milestone

Returns a new instance of Milestone.



10
11
12
13
14
15
16
# File 'lib/geet/gitlab/milestone.rb', line 10

def initialize(number, title, due_on, api_interface)
  @number = number
  @title = title
  @due_on = due_on

  @api_interface = api_interface
end

Instance Attribute Details

#due_onObject (readonly)

Returns the value of attribute due_on.



8
9
10
# File 'lib/geet/gitlab/milestone.rb', line 8

def due_on
  @due_on
end

#numberObject (readonly)

Returns the value of attribute number.



8
9
10
# File 'lib/geet/gitlab/milestone.rb', line 8

def number
  @number
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/geet/gitlab/milestone.rb', line 8

def title
  @title
end

Class Method Details

.list(api_interface) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/geet/gitlab/milestone.rb', line 20

def self.list(api_interface, **)
  api_path = "projects/#{api_interface.path_with_namespace(encoded: true)}/milestones"

  response = api_interface.send_request(api_path, multipage: true)

  response.map do |milestone_data|
    number = milestone_data.fetch('iid')
    title = milestone_data.fetch('title')
    due_on = parse_due_date(milestone_data.fetch('due_date'))

    new(number, title, due_on, api_interface)
  end
end