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
19 20 21 22 23 24 |
# File 'lib/free_agent/resources/tasks.rb', line 19 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
31 32 33 34 |
# File 'lib/free_agent/resources/tasks.rb', line 31 def delete(id:) response = delete_request("tasks/#{id}") response.success? end |
#list(**params) ⇒ Object
4 5 6 7 |
# File 'lib/free_agent/resources/tasks.rb', line 4 def list(**params) response = get_request("tasks", params: params) Collection.from_response(response, type: Task, key: "tasks") end |
#list_for_project(project:, **params) ⇒ Object
9 10 11 12 |
# File 'lib/free_agent/resources/tasks.rb', line 9 def list_for_project(project:, **params) response = get_request("tasks?project=#{project}", params: params) Collection.from_response(response, type: Task, key: "tasks") end |