Class: TrackerApi::Endpoints::Epic
- Defined in:
- lib/tracker_api/endpoints/epic.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #create(project_id, params = {}) ⇒ Object
- #get(project_id, id, params = {}) ⇒ Object
- #get_epic(epic_id, params = {}) ⇒ Object
-
#initialize(client) ⇒ Epic
constructor
A new instance of Epic.
- #update(epic, params = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Epic
Returns a new instance of Epic.
6 7 8 |
# File 'lib/tracker_api/endpoints/epic.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/tracker_api/endpoints/epic.rb', line 4 def client @client end |
Instance Method Details
#create(project_id, params = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/tracker_api/endpoints/epic.rb', line 22 def create(project_id, params={}) data = client.post("/projects/#{project_id}/epics", params: params).body Resources::Epic.new({ client: client }.merge(data)) end |
#get(project_id, id, params = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/tracker_api/endpoints/epic.rb', line 10 def get(project_id, id, params={}) data = client.get("/projects/#{project_id}/epics/#{id}", params: params).body Resources::Epic.new({ client: client, project_id: project_id }.merge(data)) end |
#get_epic(epic_id, params = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/tracker_api/endpoints/epic.rb', line 16 def get_epic(epic_id, params={}) data = client.get("/epics/#{epic_id}", params: params).body Resources::Epic.new({ client: client }.merge(data)) end |
#update(epic, params = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/tracker_api/endpoints/epic.rb', line 28 def update(epic, params={}) raise ArgumentError, 'Valid epic required to update.' unless epic.instance_of?(Resources::Epic) data = client.put("/projects/#{epic.project_id}/epics/#{epic.id}", params: params).body epic.attributes = data epic.clean! epic end |