pager_duty-connection 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -8
- data/lib/pager_duty/connection/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Or install it yourself as:
|
|
44
44
|
|
45
45
|
Working code is worth a thousand words. The basics:
|
46
46
|
|
47
|
-
|
47
|
+
```ruby
|
48
48
|
# setup the connection
|
49
49
|
pagerduty = PagerDuty::Connection.new(account, token)
|
50
50
|
|
@@ -63,7 +63,7 @@ response.incidents # an array of incidents
|
|
63
63
|
|
64
64
|
response = pagerduty.get('incidents/YYZ')
|
65
65
|
response # the hash/object that represents the array
|
66
|
-
|
66
|
+
```
|
67
67
|
|
68
68
|
For more advanced and realistic examples, check out the examples directory:
|
69
69
|
|
@@ -74,17 +74,17 @@ In general, you can get/put/post/delete a path, with some attributes. Use the [R
|
|
74
74
|
|
75
75
|
If you are working in Rails, and using only a single PagerDuty account, you'll probably want an initializer:
|
76
76
|
|
77
|
-
|
77
|
+
```ruby
|
78
78
|
$pagerduty = PagerDuty::Connection.new('your-subdomain', 'your-token')
|
79
|
-
|
79
|
+
```
|
80
80
|
|
81
81
|
And if you are using [dotenv](https://github.com/bkeepers/dotenv), you can use environment variables, and stash them in .env:
|
82
82
|
|
83
|
-
|
83
|
+
```ruby
|
84
84
|
account = ENV['PAGERDUTY_ACCOUNT'] || raise("Missing ENV['PAGERDUTY_ACCOUNT'], add to .env")
|
85
85
|
token = ENV['PAGERDUTY_TOKEN'] || raise("Missing ENV['PAGERDUTY_TOKEN'], add to .env.#{Rails.env}")
|
86
86
|
$pagerduty = PagerDuty::Connection.new(account, token)
|
87
|
-
|
87
|
+
```
|
88
88
|
|
89
89
|
## Questions and Answers
|
90
90
|
|
@@ -94,7 +94,7 @@ That is only for PagerDuty's [Integration API](http://developer.pagerduty.com/do
|
|
94
94
|
|
95
95
|
> What about the [pagerduty-full](https://github.com/gphat/pagerduty-full) gem?
|
96
96
|
|
97
|
-
It tries to be too clever and tightly models the API. For
|
97
|
+
It tries to be too clever and tightly models the API. For example, by having only Incident & Schedule classes, with specific methods for doing specific API calls, it means having to update the gem anytime new resources are added, and new API methods.
|
98
98
|
|
99
99
|
> What about [pagerduty_tools](https://github.com/precipice/pagerduty_tools)
|
100
100
|
|
@@ -106,7 +106,11 @@ That would suggest a constant like Pagerduty::Rest, which I didn't like
|
|
106
106
|
|
107
107
|
> Why not name it pagerduty-connection?
|
108
108
|
|
109
|
-
That would suggest a constant like Pagerduty::Connection
|
109
|
+
That would suggest a constant like Pagerduty::Connection, where the company is called PagerDuty.
|
110
|
+
|
111
|
+
> Why the 'connection' thing?
|
112
|
+
|
113
|
+
It's an homage to [faraday](https://github.com/lostisland/faraday), which this library uses.
|
110
114
|
|
111
115
|
## Contributing
|
112
116
|
|