Module: PagerDuty::Connection
- Included in:
- Client
- Defined in:
- lib/pager_duty/connection.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #delete(url, options = {}) ⇒ Object
- #get(url, options = {}) ⇒ Object
-
#last_response ⇒ Sawyer::Response
Response for last HTTP request.
- #patch(url, options = {}) ⇒ Object
- #post(url, options = {}) ⇒ Object
- #put(url, options = {}) ⇒ Object
-
#root ⇒ Sawyer::Resource
Fetch the root resource for the API.
Instance Attribute Details
#agent ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/pager_duty/connection.rb', line 25 def agent @agent ||= Sawyer::Agent.new(endpoint, ) do |http| http.headers[:accept] = default_media_type http.headers[:content_type] = "application/json" http.headers[:user_agent] = user_agent http.token_auth @api_token end end |
Instance Method Details
#delete(url, options = {}) ⇒ Object
21 22 23 |
# File 'lib/pager_duty/connection.rb', line 21 def delete(url, = {}) request :delete, url, end |
#get(url, options = {}) ⇒ Object
5 6 7 |
# File 'lib/pager_duty/connection.rb', line 5 def get(url, = {}) request :get, url, end |
#last_response ⇒ Sawyer::Response
Response for last HTTP request
44 45 46 |
# File 'lib/pager_duty/connection.rb', line 44 def last_response @last_response if defined? @last_response end |
#patch(url, options = {}) ⇒ Object
17 18 19 |
# File 'lib/pager_duty/connection.rb', line 17 def patch(url, = {}) request :patch, url, end |
#post(url, options = {}) ⇒ Object
9 10 11 |
# File 'lib/pager_duty/connection.rb', line 9 def post(url, = {}) request :post, url, end |
#put(url, options = {}) ⇒ Object
13 14 15 |
# File 'lib/pager_duty/connection.rb', line 13 def put(url, = {}) request :put, url, end |
#root ⇒ Sawyer::Resource
Fetch the root resource for the API
37 38 39 |
# File 'lib/pager_duty/connection.rb', line 37 def root get "/" end |