Class: FreeAgent::TasksResource
- Defined in:
- lib/free_agent/resources/tasks.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #create(project:, name:, **params) ⇒ Object
- #delete(id:) ⇒ Object
- #list(**params) ⇒ Object
- #list_for_project(project:, **params) ⇒ Object
- #retrieve(id:) ⇒ Object
- #update(id:, **params) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from FreeAgent::Resource
Instance Method Details
#create(project:, name:, **params) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/free_agent/resources/tasks.rb', line 18 def create(project:, name:, **params) attributes = { project: project, name: name } response = post_request("tasks", body: attributes.merge(params)) Task.new(response.body["task"]) if response.success? end |
#delete(id:) ⇒ Object
30 31 32 33 |
# File 'lib/free_agent/resources/tasks.rb', line 30 def delete(id:) response = delete_request("tasks/#{id}") response.success? end |
#list(**params) ⇒ Object
3 4 5 6 |
# File 'lib/free_agent/resources/tasks.rb', line 3 def list(**params) response = get_request("tasks", params: params) Collection.from_response(response, type: Task) end |
#list_for_project(project:, **params) ⇒ Object
8 9 10 11 |
# File 'lib/free_agent/resources/tasks.rb', line 8 def list_for_project(project:, **params) response = get_request("tasks?project=#{project}", params: params) Collection.from_response(response, type: Task) end |