README.md in pager_duty-connection-0.0.1 vs README.md in pager_duty-connection-0.0.2
- old
+ new
@@ -42,11 +42,11 @@
## Usage
Working code is worth a thousand words. The basics:
-`` ruby
+```ruby
# setup the connection
pagerduty = PagerDuty::Connection.new(account, token)
# 4 main methods: get, post, put, and delete:
@@ -61,42 +61,42 @@
response = pagerduty.get('incidents')
response.incidents # an array of incidents
response = pagerduty.get('incidents/YYZ')
response # the hash/object that represents the array
-``
+```
For more advanced and realistic examples, check out the examples directory:
* [shifts-with-incidents-and-log-entries](examples/shifts-with-incidents-and-log-entries.rb)
* [find-users](examples/find-users.rb)
In general, you can get/put/post/delete a path, with some attributes. Use the [REST API Documentation](http://developer.pagerduty.com/documentation/rest) to get some ideas
If you are working in Rails, and using only a single PagerDuty account, you'll probably want an initializer:
-``ruby
+```ruby
$pagerduty = PagerDuty::Connection.new('your-subdomain', 'your-token')
-``
+```
And if you are using [dotenv](https://github.com/bkeepers/dotenv), you can use environment variables, and stash them in .env:
-``ruby
+```ruby
account = ENV['PAGERDUTY_ACCOUNT'] || raise("Missing ENV['PAGERDUTY_ACCOUNT'], add to .env")
token = ENV['PAGERDUTY_TOKEN'] || raise("Missing ENV['PAGERDUTY_TOKEN'], add to .env.#{Rails.env}")
$pagerduty = PagerDuty::Connection.new(account, token)
-``
+```
## Questions and Answers
> What about the [pagerduty](https://github.com/envato/pagerduty) gem?
That is only for PagerDuty's [Integration API](http://developer.pagerduty.com/documentation/integration/events), ie for triggering/acknowleding/resolinv incidents
> What about the [pagerduty-full](https://github.com/gphat/pagerduty-full) gem?
-It tries to be too clever and tightly models the API. For exampe, 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.
+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.
> What about [pagerduty_tools](https://github.com/precipice/pagerduty_tools)
That gem is less about being an API, and more about tools for being on call. Also, it took months for [my pull request to be reviewed](https://github.com/precipice/pagerduty_tools/pull/6), so didn't give me a lot of hope for changes making it in.
@@ -104,10 +104,14 @@
That would suggest a constant like Pagerduty::Rest, which I didn't like
> Why not name it pagerduty-connection?
-That would suggest a constant like Pagerduty::Connection
+That would suggest a constant like Pagerduty::Connection, where the company is called PagerDuty.
+
+> Why the 'connection' thing?
+
+It's an homage to [faraday](https://github.com/lostisland/faraday), which this library uses.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)