pager_duty 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +17 -3
- data/Guardfile +30 -0
- data/README.md +258 -17
- data/fixtures/vcr_cassettes/abilities/index.yml +58 -0
- data/fixtures/vcr_cassettes/abilities/index_invalid.yml +48 -0
- data/fixtures/vcr_cassettes/abilities/show.yml +52 -0
- data/fixtures/vcr_cassettes/abilities/show_false.yml +56 -0
- data/fixtures/vcr_cassettes/addons/create_all_set.yml +58 -0
- data/fixtures/vcr_cassettes/addons/create_no_https_src.yml +57 -0
- data/fixtures/vcr_cassettes/addons/create_no_name.yml +57 -0
- data/fixtures/vcr_cassettes/addons/create_no_src.yml +57 -0
- data/fixtures/vcr_cassettes/addons/create_no_type.yml +57 -0
- data/fixtures/vcr_cassettes/addons/delete_P58BJWA.yml +56 -0
- data/fixtures/vcr_cassettes/addons/delete_P5R5GQ4.yml +52 -0
- data/fixtures/vcr_cassettes/addons/delete_no_id.yml +51 -0
- data/fixtures/vcr_cassettes/addons/get_by_id.yml +61 -0
- data/fixtures/vcr_cassettes/addons/get_deleted.yml +109 -0
- data/fixtures/vcr_cassettes/addons/index.yml +63 -0
- data/fixtures/vcr_cassettes/addons/index_with_services.yml +65 -0
- data/fixtures/vcr_cassettes/addons/index_with_services_by_service_id.yml +65 -0
- data/fixtures/vcr_cassettes/addons/index_with_services_filtered_to_full_page_addon.yml +60 -0
- data/fixtures/vcr_cassettes/addons/update_by_id.yml +119 -0
- data/fixtures/vcr_cassettes/addons/update_by_id_name_only.yml +119 -0
- data/fixtures/vcr_cassettes/escalation_policies/create_does_not_work.yml +61 -0
- data/fixtures/vcr_cassettes/escalation_policies/create_no_escalation_rule_targets.yml +57 -0
- data/fixtures/vcr_cassettes/escalation_policies/create_works.yml +67 -0
- data/fixtures/vcr_cassettes/escalation_policies/delete_P09984M_allowed.yml +163 -0
- data/fixtures/vcr_cassettes/escalation_policies/delete_P7N334Z.yml +56 -0
- data/fixtures/vcr_cassettes/escalation_policies/get_by_id.yml +61 -0
- data/fixtures/vcr_cassettes/escalation_policies/get_deleted.yml +56 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_include_services.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_include_services_teams.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_include_services_teams_targets.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_multiple_user_ids.yml +72 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_name_asc.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_name_desc.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_no_query.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_query.yml +65 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_team_ids.yml +65 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_user_id_has_five.yml +76 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_user_id_has_four.yml +72 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_user_id_has_one.yml +62 -0
- data/fixtures/vcr_cassettes/escalation_policies/index_user_id_nothing.yml +58 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_description_only.yml +126 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_escalation_rules_only.yml +125 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_escalation_rules_user.yml +125 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_name_only.yml +122 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_no_name.yml +119 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_num_loops_only.yml +125 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_repeat_enabled_only.yml +125 -0
- data/fixtures/vcr_cassettes/escalation_policies/update_teams.yml +125 -0
- data/fixtures/vcr_cassettes/incidents/incident.yml +125 -0
- data/fixtures/vcr_cassettes/incidents/incident_alerts/P6M04C7.yml +61 -0
- data/fixtures/vcr_cassettes/incidents/incident_alerts/alert_key.yml +61 -0
- data/fixtures/vcr_cassettes/incidents/incident_alerts/status_resolved.yml +61 -0
- data/fixtures/vcr_cassettes/incidents/incident_log_entries/P6M04C7.yml +90 -0
- data/fixtures/vcr_cassettes/incidents/incident_log_entries/P6M04C7_include.yml +114 -0
- data/fixtures/vcr_cassettes/incidents/incident_log_entries/P6M04C7_is_overview.yml +69 -0
- data/fixtures/vcr_cassettes/incidents/incident_notes/P6M04C7.yml +58 -0
- data/fixtures/vcr_cassettes/incidents/incident_notes/P9XCW88.yml +60 -0
- data/fixtures/vcr_cassettes/incidents/index/acknowledged.yml +67 -0
- data/fixtures/vcr_cassettes/incidents/index/all_statuses.yml +182 -0
- data/fixtures/vcr_cassettes/incidents/index/created_at_asc.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/created_at_desc.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/date_range_all.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/incident_key.yml +65 -0
- data/fixtures/vcr_cassettes/incidents/index/include_users.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/include_users_services.yml +235 -0
- data/fixtures/vcr_cassettes/incidents/index/limited.yml +77 -0
- data/fixtures/vcr_cassettes/incidents/index/no_query.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/resolved.yml +166 -0
- data/fixtures/vcr_cassettes/incidents/index/service_id_P407C9R.yml +168 -0
- data/fixtures/vcr_cassettes/incidents/index/service_id_P7WQ2DJ_P407C9R.yml +71 -0
- data/fixtures/vcr_cassettes/incidents/index/team_ids_P1HE60B.yml +79 -0
- data/fixtures/vcr_cassettes/incidents/index/team_ids_P1HE60B_P7XILUG.yml +79 -0
- data/fixtures/vcr_cassettes/incidents/index/team_ids_P7XILUG.yml +65 -0
- data/fixtures/vcr_cassettes/incidents/index/time_zone.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/triggered.yml +73 -0
- data/fixtures/vcr_cassettes/incidents/index/urgencies_high.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/urgencies_high_low.yml +181 -0
- data/fixtures/vcr_cassettes/incidents/index/urgencies_low.yml +58 -0
- data/fixtures/vcr_cassettes/incidents/index/user_ids_PDU9IB6.yml +65 -0
- data/fixtures/vcr_cassettes/incidents/index/user_ids_PDU9IB6_PGJLPE9.yml +65 -0
- data/fixtures/vcr_cassettes/incidents/index/user_ids_PGJLPE9.yml +66 -0
- data/fixtures/vcr_cassettes/incidents/merge_incidents/PD9WJA8_PZMITGO.yml +69 -0
- data/fixtures/vcr_cassettes/incidents/snooze_incident/PD9WJA8.yml +58 -0
- data/fixtures/vcr_cassettes/incidents/snooze_incident/PD9WJA8_acknowledged.yml +69 -0
- data/fixtures/vcr_cassettes/incidents/update_incidents/PD9WJA8.yml +67 -0
- data/fixtures/vcr_cassettes/unauthorized_nil_token.yml +48 -0
- data/lib/pager_duty.rb +14 -1
- data/lib/pager_duty/client.rb +29 -0
- data/lib/pager_duty/client/abilities.rb +33 -0
- data/lib/pager_duty/client/addons.rb +97 -0
- data/lib/pager_duty/client/escalation_policies.rb +148 -0
- data/lib/pager_duty/client/incidents.rb +228 -0
- data/lib/pager_duty/configurable.rb +32 -0
- data/lib/pager_duty/connection.rb +110 -0
- data/lib/pager_duty/default.rb +79 -0
- data/lib/pager_duty/error.rb +171 -0
- data/lib/pager_duty/response/raise_error.rb +21 -0
- data/lib/pager_duty/version.rb +1 -1
- data/output.yaml +7842 -0
- data/pager_duty.gemspec +11 -3
- data/script/bootstrap +5 -0
- data/script/console +11 -0
- data/script/test +13 -0
- metadata +239 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5c7e9d697088cf476aa25e0e7c82f645b25b6f0
|
|
4
|
+
data.tar.gz: 6b294a232570d2537433ee9059f58362c66799d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81bc454c8fc420166338501b57c5d520026d1ce01e84bd56969c6a1705a0d53deebbd2b177c99e9582e005dfc98c06398a8e23bb08671b19a2450f6e98be6395
|
|
7
|
+
data.tar.gz: 29238ac01a3e4e194ecdeb5f2a179df9c0ea9cf05f0d6fdf01b3e01603f0b9314f1be9a1bdc442ca0f620b0f4d257bf73a256eeb2f4ea167ebeaaa9ddfef31c2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
sudo: false
|
|
2
1
|
language: ruby
|
|
2
|
+
cache: bundler
|
|
3
|
+
|
|
3
4
|
rvm:
|
|
4
|
-
- 2.
|
|
5
|
-
|
|
5
|
+
- 2.3.3
|
|
6
|
+
- 2.4.0
|
|
7
|
+
|
|
8
|
+
notifications:
|
|
9
|
+
email:
|
|
10
|
+
recipients:
|
|
11
|
+
- patrick.veverka@gmail.com
|
|
12
|
+
on_success: always # default: change
|
|
13
|
+
on_failure: always # default: always
|
|
14
|
+
|
|
15
|
+
sudo: false
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
global:
|
|
19
|
+
- TEST_API_TOKEN="y_NbAkKc66ryYTWUXYEu"
|
data/Guardfile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
|
5
|
+
# directories %w(app lib config test spec features) \
|
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
|
7
|
+
|
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
11
|
+
#
|
|
12
|
+
# $ mkdir config
|
|
13
|
+
# $ mv Guardfile config/
|
|
14
|
+
# $ ln -s config/Guardfile .
|
|
15
|
+
#
|
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
17
|
+
group :ruby do
|
|
18
|
+
guard :minitest do
|
|
19
|
+
# with Minitest::Unit
|
|
20
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
|
21
|
+
watch(%r{^test/.+_test\.rb$})
|
|
22
|
+
watch('test/test_helper.rb') { "test" }
|
|
23
|
+
watch('test/test_helper_integration.rb') { "test" }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
guard 'yard' do
|
|
29
|
+
watch(%r{lib\/.+\.rb})
|
|
30
|
+
end
|
data/README.md
CHANGED
|
@@ -1,41 +1,282 @@
|
|
|
1
1
|
# PagerDuty
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://travis-ci.org/veverkap/pager_duty)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://codebeat.co/projects/github-com-veverkap-pager_duty-master)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Ruby client for v2 of the [PagerDuty API](https://v2.developer.pagerduty.com/v2/page/api-reference)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
1. [Philosophy](#philosophy)
|
|
12
|
+
2. [Quick start](#quick-start)
|
|
13
|
+
3. [Making requests](#making-requests)
|
|
14
|
+
4. [Consuming resources](#consuming-resources)
|
|
15
|
+
6. [Authentication](#authentication)
|
|
16
|
+
1. [API tokens](#api-tokens)
|
|
17
|
+
7. [Configuration and defaults](#configuration-and-defaults)
|
|
18
|
+
1. [Configuring module defaults](#configuring-module-defaults)
|
|
19
|
+
2. [Using ENV variables](#using-env-variables)
|
|
20
|
+
8. [Advanced usage](#advanced-usage)
|
|
21
|
+
1. [Debugging](#debugging)
|
|
22
|
+
2. [Caching](#caching)
|
|
23
|
+
9. [Hacking on PagerDuty](#hacking-on-pagerduty)
|
|
24
|
+
1. [Running and writing new tests](#running-and-writing-new-tests)
|
|
25
|
+
10. [Supported Ruby Versions](#supported-ruby-versions)
|
|
26
|
+
11. [Versioning](#versioning)
|
|
27
|
+
12. [License](#license)
|
|
28
|
+
|
|
29
|
+
## Philosophy
|
|
30
|
+
|
|
31
|
+
This gem borrows liberally from the design philosophy of the
|
|
32
|
+
wonderful [octokit](https://github.com/octokit/octokit.rb) library.
|
|
33
|
+
Most methods have positional arguments for required input and an options hash
|
|
34
|
+
for optional parameters, headers, or other options:
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
Install via Rubygems
|
|
39
|
+
|
|
40
|
+
gem install pager_duty
|
|
41
|
+
|
|
42
|
+
... or add to your Gemfile
|
|
43
|
+
|
|
44
|
+
gem "pager_duty", "~> 0.1"
|
|
45
|
+
|
|
46
|
+
### Making requests
|
|
47
|
+
|
|
48
|
+
[API methods][] are available as module methods (consuming module-level
|
|
49
|
+
configuration) or as client instance methods.
|
|
10
50
|
|
|
11
51
|
```ruby
|
|
12
|
-
|
|
52
|
+
# Provide authentication credentials
|
|
53
|
+
PagerDuty.configure do |c|
|
|
54
|
+
c.api_token = "XXXXXXXX"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Fetch the current user
|
|
58
|
+
PagerDuty.abilities
|
|
13
59
|
```
|
|
60
|
+
or
|
|
14
61
|
|
|
15
|
-
|
|
62
|
+
```ruby
|
|
63
|
+
# Provide authentication credentials
|
|
64
|
+
client = PagerDuty::Client.new(api_token: "XXXXXXXX")
|
|
65
|
+
# Fetch the current user
|
|
66
|
+
client.abilities
|
|
67
|
+
```
|
|
16
68
|
|
|
17
|
-
|
|
69
|
+
[API methods]: http://veverkap.github.io/pager_duty/method_list.html
|
|
18
70
|
|
|
19
|
-
|
|
71
|
+
### Consuming resources
|
|
20
72
|
|
|
21
|
-
|
|
73
|
+
Most methods return a `Resource` object which provides dot notation and `[]`
|
|
74
|
+
access for fields returned in the API response.
|
|
22
75
|
|
|
23
|
-
|
|
76
|
+
```ruby
|
|
77
|
+
# Fetch a user
|
|
78
|
+
addon = PagerDuty.addon("P5R5GQ4")
|
|
79
|
+
puts addon.name
|
|
80
|
+
# => "Great Addon"
|
|
81
|
+
puts addon.fields
|
|
82
|
+
# => <Set: {:id, :type, :summary, :self, :html_url, :name, :src, :services}>
|
|
83
|
+
puts addon[:type]
|
|
84
|
+
# => "full_page_addon"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Authentication
|
|
24
88
|
|
|
25
|
-
|
|
89
|
+
PagerDuty supports the API token method for authentication:
|
|
26
90
|
|
|
27
|
-
|
|
91
|
+
### API Tokens
|
|
28
92
|
|
|
29
|
-
|
|
93
|
+
API tokens can be revoked, removing access for only that token without having to change your password everywhere.
|
|
30
94
|
|
|
31
|
-
To
|
|
95
|
+
To use an access token with the PagerDuty client, pass your token in the `:access_token` options parameter:
|
|
32
96
|
|
|
33
|
-
|
|
97
|
+
```ruby
|
|
98
|
+
client = PagerDuty::Client.new(:access_token => "<your token>")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
You can create access tokens through your Account Settings which are typically at https://YOURSUBDOMAIN.pagerduty.com/api_keys
|
|
102
|
+
|
|
103
|
+
### Using ENV variables
|
|
104
|
+
|
|
105
|
+
Default configuration values are specified in {PagerDuty::Default}. Many
|
|
106
|
+
attributes will look for a default value from the ENV before returning
|
|
107
|
+
PagerDuty's default.
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
# Given $PAGERDUTY_API_ENDPOINT is "http://api.pagerduty.dev"
|
|
111
|
+
PagerDuty.api_endpoint
|
|
112
|
+
|
|
113
|
+
# => "http://api.pagerduty.dev"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Advanced usage
|
|
117
|
+
|
|
118
|
+
Since PagerDuty employs [Faraday][faraday] under the hood, some behavior can be
|
|
119
|
+
extended via middleware.
|
|
120
|
+
|
|
121
|
+
### Debugging
|
|
122
|
+
|
|
123
|
+
Often, it helps to know what PagerDuty is doing under the hood. You can add a
|
|
124
|
+
logger to the middleware that enables you to peek into the underlying HTTP
|
|
125
|
+
traffic:
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
stack = Faraday::RackBuilder.new do |builder|
|
|
129
|
+
builder.response :logger
|
|
130
|
+
builder.use PagerDuty::Response::RaiseError
|
|
131
|
+
builder.adapter Faraday.default_adapter
|
|
132
|
+
end
|
|
133
|
+
PagerDuty.middleware = stack
|
|
134
|
+
PagerDuty.abilities
|
|
135
|
+
```
|
|
136
|
+
```
|
|
137
|
+
I, [2017-05-22T12:47:16.335959 #79147] INFO -- : GET https://api.pagerduty.com/abilities
|
|
138
|
+
D, [2017-05-22T12:47:16.336026 #79147] DEBUG -- : "Accept: application/vnd.pagerduty+json;version=2
|
|
139
|
+
User-Agent: PagerDuty Ruby Gem 0.1.0
|
|
140
|
+
Content-Type: application/json
|
|
141
|
+
Authorization: Token token=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\""
|
|
142
|
+
I, [2017-05-22T12:47:16.350493 #79147] INFO -- : HTTP 200
|
|
143
|
+
D, [2017-05-22T12:47:16.350568 #79147] DEBUG -- : "server: nginx
|
|
144
|
+
date: Fri, 19 May 2017 14:02:40 GMT
|
|
145
|
+
content-type: application/json; charset=utf-8
|
|
146
|
+
transfer-encoding: chunked
|
|
147
|
+
connection: keep-alive
|
|
148
|
+
status: 200 OK
|
|
149
|
+
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
|
|
150
|
+
access-control-max-age: 1728000
|
|
151
|
+
access-control-allow-origin: *
|
|
152
|
+
access-control-allow-headers: Authorization, Content-Type
|
|
153
|
+
x-ua-compatible: IE=Edge,chrome=1
|
|
154
|
+
etag: W/\"0da61ef0d8a5571c22d819a5ed89665e\"
|
|
155
|
+
cache-control: max-age=0, private, must-revalidate
|
|
156
|
+
x-request-id: 5f125e02489796ac002cf0f7a321fe88
|
|
157
|
+
|
|
158
|
+
{\"abilities\":[\"sso\",\"advanced_reports\",\"teams\",\"read_only_users\",\"team_responders\",\"service_support_hours\",\"urgencies\",\"manage_schedules\",\"manage_api_keys\",\"coordinated_responding\",\"event_rules\",\"beta_custom_actions\",\"coordinated_responding_preview\",\"preview_incident_alert_split\",\"permissions_service\",\"on_call_selfie\",\"features_in_use_preventing_downgrade_to\",\"feature_to_plan_map\"]}"
|
|
159
|
+
...
|
|
160
|
+
```
|
|
34
161
|
|
|
35
|
-
|
|
162
|
+
See the [Faraday README][faraday] for more middleware magic.
|
|
36
163
|
|
|
164
|
+
### Caching
|
|
165
|
+
|
|
166
|
+
If you want to boost performance, stretch your API rate limit, or avoid paying
|
|
167
|
+
the hypermedia tax, you can use [Faraday Http Cache][cache].
|
|
168
|
+
|
|
169
|
+
Add the gem to your Gemfile
|
|
170
|
+
|
|
171
|
+
gem 'faraday-http-cache'
|
|
172
|
+
|
|
173
|
+
Next, construct your own Faraday middleware:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
stack = Faraday::RackBuilder.new do |builder|
|
|
177
|
+
builder.use Faraday::HttpCache, serializer: Marshal, shared_cache: false
|
|
178
|
+
builder.use PagerDuty::Response::RaiseError
|
|
179
|
+
builder.adapter Faraday.default_adapter
|
|
180
|
+
end
|
|
181
|
+
PagerDuty.middleware = stack
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Once configured, the middleware will store responses in cache based on ETag
|
|
185
|
+
fingerprint and serve those back up for future `304` responses for the same
|
|
186
|
+
resource. See the [project README][cache] for advanced usage.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
[cache]: https://github.com/plataformatec/faraday-http-cache
|
|
190
|
+
[faraday]: https://github.com/lostisland/faraday
|
|
191
|
+
|
|
192
|
+
## Hacking on PagerDuty
|
|
193
|
+
|
|
194
|
+
If you want to hack on PagerDuty locally, we try to make [bootstrapping the
|
|
195
|
+
project][bootstrapping] as painless as possible. To start hacking, clone and run:
|
|
196
|
+
|
|
197
|
+
script/bootstrap
|
|
198
|
+
|
|
199
|
+
This will install project dependencies and get you up and running. If you want
|
|
200
|
+
to run a Ruby console to poke on PagerDuty, you can crank one up with:
|
|
201
|
+
|
|
202
|
+
script/console
|
|
203
|
+
|
|
204
|
+
Using the scripts in `./scripts` instead of `bundle exec rspec`, `bundle
|
|
205
|
+
console`, etc. ensures your dependencies are up-to-date.
|
|
206
|
+
|
|
207
|
+
### Running and writing new tests
|
|
208
|
+
|
|
209
|
+
PagerDuty uses [VCR][] for recording and playing back API fixtures during test
|
|
210
|
+
runs. These cassettes (fixtures) are part of the Git project in the `spec/cassettes`
|
|
211
|
+
folder. If you're not recording new cassettes you can run the specs with existing
|
|
212
|
+
cassettes with:
|
|
213
|
+
|
|
214
|
+
script/test
|
|
215
|
+
|
|
216
|
+
[bootstrapping]: http://wynnnetherland.com/linked/2013012801/bootstrapping-consistency
|
|
217
|
+
[VCR]: https://github.com/vcr/vcr
|
|
218
|
+
|
|
219
|
+
## Supported Ruby Versions
|
|
220
|
+
|
|
221
|
+
This library aims to support and is [tested against][travis] the following Ruby
|
|
222
|
+
implementations:
|
|
223
|
+
|
|
224
|
+
* Ruby 2.3
|
|
225
|
+
* Ruby 2.4
|
|
226
|
+
|
|
227
|
+
If something doesn't work on one of these Ruby versions, it's a bug.
|
|
228
|
+
|
|
229
|
+
This library may inadvertently work (or seem to work) on other Ruby
|
|
230
|
+
implementations, but support will only be provided for the versions listed
|
|
231
|
+
above.
|
|
232
|
+
|
|
233
|
+
If you would like this library to support another Ruby version, you may
|
|
234
|
+
volunteer to be a maintainer. Being a maintainer entails making sure all tests
|
|
235
|
+
run and pass on that implementation. When something breaks on your
|
|
236
|
+
implementation, you will be responsible for providing patches in a timely
|
|
237
|
+
fashion. If critical issues for a particular implementation exist at the time
|
|
238
|
+
of a major release, support for that Ruby version may be dropped.
|
|
239
|
+
|
|
240
|
+
[travis]: https://travis-ci.org/veverkap/pager_duty
|
|
241
|
+
|
|
242
|
+
## Versioning
|
|
243
|
+
|
|
244
|
+
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
|
|
245
|
+
of this scheme should be reported as bugs. Specifically, if a minor or patch
|
|
246
|
+
version is released that breaks backward compatibility, that version should be
|
|
247
|
+
immediately yanked and/or a new version should be immediately released that
|
|
248
|
+
restores compatibility. Breaking changes to the public API will only be
|
|
249
|
+
introduced with new major versions. As a result of this policy, you can (and
|
|
250
|
+
should) specify a dependency on this gem using the [Pessimistic Version
|
|
251
|
+
Constraint][pvc] with two digits of precision. For example:
|
|
252
|
+
|
|
253
|
+
spec.add_dependency 'pager_duty', '~> 3.0'
|
|
254
|
+
|
|
255
|
+
The changes made between versions can be seen on the [project releases page][releases].
|
|
256
|
+
|
|
257
|
+
[semver]: http://semver.org/
|
|
258
|
+
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
259
|
+
[releases]: https://github.com/veverkap/pager_duty/releases
|
|
37
260
|
|
|
38
261
|
## License
|
|
39
262
|
|
|
40
|
-
|
|
263
|
+
Copyright (c) 2017 Patrick Veverka
|
|
264
|
+
|
|
265
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
266
|
+
a copy of this software and associated documentation files (the
|
|
267
|
+
"Software"), to deal in the Software without restriction, including
|
|
268
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
269
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
270
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
271
|
+
the following conditions:
|
|
272
|
+
|
|
273
|
+
The above copyright notice and this permission notice shall be
|
|
274
|
+
included in all copies or substantial portions of the Software.
|
|
41
275
|
|
|
276
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
277
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
278
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
279
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
280
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
281
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
282
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.pagerduty.com/abilities
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/vnd.pagerduty+json;version=2
|
|
12
|
+
User-Agent:
|
|
13
|
+
- PagerDuty Ruby Gem 0.1.0
|
|
14
|
+
Content-Type:
|
|
15
|
+
- application/json
|
|
16
|
+
Authorization:
|
|
17
|
+
- Token token="y_NbAkKc66ryYTWUXYEu"
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- nginx
|
|
27
|
+
Date:
|
|
28
|
+
- Fri, 19 May 2017 14:02:40 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- application/json; charset=utf-8
|
|
31
|
+
Transfer-Encoding:
|
|
32
|
+
- chunked
|
|
33
|
+
Connection:
|
|
34
|
+
- keep-alive
|
|
35
|
+
Status:
|
|
36
|
+
- 200 OK
|
|
37
|
+
Access-Control-Allow-Methods:
|
|
38
|
+
- GET, POST, PUT, DELETE, OPTIONS
|
|
39
|
+
Access-Control-Max-Age:
|
|
40
|
+
- '1728000'
|
|
41
|
+
Access-Control-Allow-Origin:
|
|
42
|
+
- "*"
|
|
43
|
+
Access-Control-Allow-Headers:
|
|
44
|
+
- Authorization, Content-Type
|
|
45
|
+
X-Ua-Compatible:
|
|
46
|
+
- IE=Edge,chrome=1
|
|
47
|
+
Etag:
|
|
48
|
+
- W/"0da61ef0d8a5571c22d819a5ed89665e"
|
|
49
|
+
Cache-Control:
|
|
50
|
+
- max-age=0, private, must-revalidate
|
|
51
|
+
X-Request-Id:
|
|
52
|
+
- 5f125e02489796ac002cf0f7a321fe88
|
|
53
|
+
body:
|
|
54
|
+
encoding: ASCII-8BIT
|
|
55
|
+
string: '{"abilities":["sso","advanced_reports","teams","read_only_users","team_responders","service_support_hours","urgencies","manage_schedules","manage_api_keys","coordinated_responding","event_rules","beta_custom_actions","coordinated_responding_preview","preview_incident_alert_split","permissions_service","on_call_selfie","features_in_use_preventing_downgrade_to","feature_to_plan_map"]}'
|
|
56
|
+
http_version:
|
|
57
|
+
recorded_at: Fri, 19 May 2017 14:02:43 GMT
|
|
58
|
+
recorded_with: VCR 3.0.3
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.pagerduty.com/abilities
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/vnd.pagerduty+json;version=2
|
|
12
|
+
User-Agent:
|
|
13
|
+
- PagerDuty Ruby Gem 0.1.0
|
|
14
|
+
Content-Type:
|
|
15
|
+
- application/json
|
|
16
|
+
Authorization:
|
|
17
|
+
- Token token="y_NbAkKc66ryYTWUYzEu"
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 401
|
|
23
|
+
message: Unauthorized
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- nginx
|
|
27
|
+
Date:
|
|
28
|
+
- Mon, 22 May 2017 16:21:20 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- text/html; charset=utf-8
|
|
31
|
+
Transfer-Encoding:
|
|
32
|
+
- chunked
|
|
33
|
+
Connection:
|
|
34
|
+
- keep-alive
|
|
35
|
+
Status:
|
|
36
|
+
- 401 Unauthorized
|
|
37
|
+
X-Ua-Compatible:
|
|
38
|
+
- IE=Edge,chrome=1
|
|
39
|
+
Cache-Control:
|
|
40
|
+
- no-cache
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- 9795a47c574d50138040d4c6e83b3e34
|
|
43
|
+
body:
|
|
44
|
+
encoding: UTF-8
|
|
45
|
+
string: " "
|
|
46
|
+
http_version:
|
|
47
|
+
recorded_at: Mon, 22 May 2017 16:21:20 GMT
|
|
48
|
+
recorded_with: VCR 3.0.3
|