Class: PagerDutyRestClient
- Inherits:
-
Object
- Object
- PagerDutyRestClient
- Defined in:
- lib/pager_duty_rest_client.rb,
lib/pager_duty_rest_client/version.rb
Constant Summary collapse
- VERSION =
'0.2'
Instance Method Summary collapse
- #get_incidents_count(extra_args = {}) ⇒ Object
- #get_incidents_data(extra_args = {}) ⇒ Object
- #get_schedule_data(code, from, to, extra_args = {}) ⇒ Object
-
#initialize(org_name, username, password) ⇒ PagerDutyRestClient
constructor
A new instance of PagerDutyRestClient.
Constructor Details
#initialize(org_name, username, password) ⇒ PagerDutyRestClient
Returns a new instance of PagerDutyRestClient.
7 8 9 10 11 |
# File 'lib/pager_duty_rest_client.rb', line 7 def initialize(org_name, username, password) @org_name = org_name @username = username @password = password end |
Instance Method Details
#get_incidents_count(extra_args = {}) ⇒ Object
27 28 29 30 |
# File 'lib/pager_duty_rest_client.rb', line 27 def get_incidents_count(extra_args = {}) path = "/api/v1/incidents/count" authenticated_get(path, extra_args) end |
#get_incidents_data(extra_args = {}) ⇒ Object
22 23 24 25 |
# File 'lib/pager_duty_rest_client.rb', line 22 def get_incidents_data(extra_args = {}) path = "/api/v1/incidents" authenticated_get(path, extra_args) end |
#get_schedule_data(code, from, to, extra_args = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pager_duty_rest_client.rb', line 13 def get_schedule_data(code, from, to, extra_args = {}) path = "/api/v1/schedules/#{code}/entries" form_data = { 'since' => pagerduty_time_string(from), 'until' => pagerduty_time_string(to) }.merge(extra_args) authenticated_get(path, form_data) end |