Class: Sifterology::ProjectFactory
- Inherits:
-
Resource
- Object
- Resource
- Sifterology::ProjectFactory
show all
- Defined in:
- lib/sifterology/factories/project_factory.rb
Instance Attribute Summary
Attributes inherited from Resource
#factory, #last_request, #session
Instance Method Summary
collapse
Methods inherited from Resource
#attributes=, #delete, #get, #initialize, #local_attributes=, #post, #put, sifter_attrs
Instance Method Details
#build(attributes) ⇒ Object
17
18
19
20
21
|
# File 'lib/sifterology/factories/project_factory.rb', line 17
def build(attributes)
Project.new(session, self).tap do |p|
p.attributes = attributes
end
end
|
#entity_base ⇒ Object
5
6
7
|
# File 'lib/sifterology/factories/project_factory.rb', line 5
def entity_base
'/api/projects'
end
|
#find_all ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/sifterology/factories/project_factory.rb', line 9
def find_all
[].tap do |arr|
get("#{ entity_base }/?all=true")['projects'].each do |project_attrs|
arr << build(project_attrs)
end
end
end
|
#new_from_url(url) ⇒ Object
23
24
25
26
27
|
# File 'lib/sifterology/factories/project_factory.rb', line 23
def new_from_url(url)
Project.new(session, self).tap do |p|
p.api_url = url
end
end
|