Class: StatusPage::API::ComponentList
- Extended by:
- Forwardable
- Defined in:
- lib/status_page/api/component_list.rb
Instance Attribute Summary collapse
-
#page_id ⇒ Object
Returns the value of attribute page_id.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(page_id) ⇒ ComponentList
constructor
A new instance of ComponentList.
- #resource_path ⇒ Object
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_id ⇒ Object
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
#get ⇒ Object
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_path ⇒ Object
21 22 23 |
# File 'lib/status_page/api/component_list.rb', line 21 def resource_path "pages/#{page_id}/components.json" end |