Class: Basecamp::Services::GaugesService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::GaugesService
- Defined in:
- lib/basecamp/generated/services/gauges_service.rb
Overview
Service for Gauges operations
Instance Method Summary collapse
-
#create_gauge_needle(project_id:, gauge_needle:, notify: nil, subscriptions: nil) ⇒ Hash
Create a gauge needle (progress update) for a project.
-
#destroy_gauge_needle(needle_id:) ⇒ void
Destroy a gauge needle.
-
#get_gauge_needle(needle_id:) ⇒ Hash
Get a gauge needle by ID.
-
#list_gauge_needles(project_id:) ⇒ Enumerator<Hash>
List gauge needles for a project, ordered newest first.
-
#list_gauges(bucket_ids: nil) ⇒ Enumerator<Hash>
List gauges across all projects the authenticated user has access to.
-
#toggle_gauge(project_id:, gauge:) ⇒ void
Enable or disable the gauge for a project.
-
#update_gauge_needle(needle_id:, gauge_needle: nil) ⇒ Hash
Update a gauge needle's description.
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create_gauge_needle(project_id:, gauge_needle:, notify: nil, subscriptions: nil) ⇒ Hash
Create a gauge needle (progress update) for a project
65 66 67 68 69 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 65 def create_gauge_needle(project_id:, gauge_needle:, notify: nil, subscriptions: nil) with_operation(service: "gauges", operation: "create_gauge_needle", is_mutation: true, project_id: project_id) do http_post("/projects/#{project_id}/gauge/needles.json", body: compact_params(gauge_needle: gauge_needle, notify: notify, subscriptions: subscriptions)).json end end |
#destroy_gauge_needle(needle_id:) ⇒ void
This method returns an undefined value.
Destroy a gauge needle
32 33 34 35 36 37 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 32 def destroy_gauge_needle(needle_id:) with_operation(service: "gauges", operation: "destroy_gauge_needle", is_mutation: true, resource_id: needle_id) do http_delete("/gauge_needles/#{needle_id}") nil end end |
#get_gauge_needle(needle_id:) ⇒ Hash
Get a gauge needle by ID
13 14 15 16 17 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 13 def get_gauge_needle(needle_id:) with_operation(service: "gauges", operation: "get_gauge_needle", is_mutation: false, resource_id: needle_id) do http_get("/gauge_needles/#{needle_id}").json end end |
#list_gauge_needles(project_id:) ⇒ Enumerator<Hash>
List gauge needles for a project, ordered newest first.
53 54 55 56 57 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 53 def list_gauge_needles(project_id:) wrap_paginated(service: "gauges", operation: "list_gauge_needles", is_mutation: false, project_id: project_id) do paginate("/projects/#{project_id}/gauge/needles.json") end end |
#list_gauges(bucket_ids: nil) ⇒ Enumerator<Hash>
List gauges across all projects the authenticated user has access to.
75 76 77 78 79 80 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 75 def list_gauges(bucket_ids: nil) wrap_paginated(service: "gauges", operation: "list_gauges", is_mutation: false) do params = compact_query_params(bucket_ids: bucket_ids) paginate("/reports/gauges.json", params: params) end end |
#toggle_gauge(project_id:, gauge:) ⇒ void
This method returns an undefined value.
Enable or disable the gauge for a project. Only project admins can toggle gauges.
43 44 45 46 47 48 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 43 def toggle_gauge(project_id:, gauge:) with_operation(service: "gauges", operation: "toggle_gauge", is_mutation: true, project_id: project_id) do http_put("/projects/#{project_id}/gauge.json", body: compact_params(gauge: gauge)) nil end end |
#update_gauge_needle(needle_id:, gauge_needle: nil) ⇒ Hash
Update a gauge needle's description. Position and color are immutable.
23 24 25 26 27 |
# File 'lib/basecamp/generated/services/gauges_service.rb', line 23 def update_gauge_needle(needle_id:, gauge_needle: nil) with_operation(service: "gauges", operation: "update_gauge_needle", is_mutation: true, resource_id: needle_id) do http_put("/gauge_needles/#{needle_id}", body: compact_params(gauge_needle: gauge_needle)).json end end |