Class: Enginn::ProjectsIndex
- Inherits:
-
ResourceIndex
- Object
- ResourceIndex
- Enginn::ProjectsIndex
- Defined in:
- lib/enginn/projects_index.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Attributes inherited from ResourceIndex
#errors, #filters, #pagination, #project
Class Method Summary collapse
Instance Method Summary collapse
- #fetch! ⇒ Object
-
#initialize(client) ⇒ ProjectsIndex
constructor
A new instance of ProjectsIndex.
- #route ⇒ Object private
Methods inherited from ResourceIndex
#each, #fetch, #inspect, #page, path, #per, #where
Constructor Details
#initialize(client) ⇒ ProjectsIndex
Returns a new instance of ProjectsIndex.
13 14 15 16 |
# File 'lib/enginn/projects_index.rb', line 13 def initialize(client) @client = client super(self) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/enginn/projects_index.rb', line 10 def client @client end |
Class Method Details
.resource ⇒ Object
6 7 8 |
# File 'lib/enginn/projects_index.rb', line 6 def self.resource Project end |
Instance Method Details
#fetch! ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/enginn/projects_index.rb', line 19 def fetch! response = request @pagination = response[:pagination] @collection = response[:result].map do |attributes| self.class.resource.new(@client, attributes) end self end |
#route ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/enginn/projects_index.rb', line 29 def route 'projects' end |