Class: StatusPage::API::ComponentList

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/status_page/api/component_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#execute, #get_resource, #patch_resource

Constructor Details

#initialize(page_id) ⇒ ComponentList

Returns a new instance of ComponentList.



9
10
11
# File 'lib/status_page/api/component_list.rb', line 9

def initialize(page_id)
  @page_id = page_id
end

Instance Attribute Details

#page_idObject

Returns the value of attribute page_id.



7
8
9
# File 'lib/status_page/api/component_list.rb', line 7

def page_id
  @page_id
end

Instance Method Details

#getObject



13
14
15
16
17
18
19
# File 'lib/status_page/api/component_list.rb', line 13

def get
  @components = get_resource.map do |attributes|
    comp = Component.new attributes["id"], attributes["page_id"]
    comp.assign_attributes attributes
    comp
  end
end

#resource_pathObject



21
22
23
# File 'lib/status_page/api/component_list.rb', line 21

def resource_path
  "pages/#{page_id}/components.json"
end