Class: PagerJudy::API::Client
- Inherits:
-
Object
- Object
- PagerJudy::API::Client
- Defined in:
- lib/pager_judy/api/client.rb
Overview
Communicate with the PagerDuty API.
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #collection(type) ⇒ Object
- #escalation_policies ⇒ Object
- #extensions ⇒ Object
- #incidents ⇒ Object
-
#initialize(api_key, base_uri: "https://api.pagerduty.com/", logger: nil, dry_run: false) ⇒ Client
constructor
A new instance of Client.
- #log_entries ⇒ Object
- #notifications ⇒ Object
- #oncalls ⇒ Object
- #schedules ⇒ Object
- #services ⇒ Object
- #teams ⇒ Object
- #users ⇒ Object
- #vendors ⇒ Object
Constructor Details
#initialize(api_key, base_uri: "https://api.pagerduty.com/", logger: nil, dry_run: false) ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/pager_judy/api/client.rb', line 12 def initialize(api_key, base_uri: "https://api.pagerduty.com/", logger: nil, dry_run: false) @root = Resource.new(api_key: api_key, uri: URI(base_uri), logger: logger, dry_run: dry_run) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
16 17 18 |
# File 'lib/pager_judy/api/client.rb', line 16 def root @root end |
Instance Method Details
#collection(type) ⇒ Object
18 19 20 |
# File 'lib/pager_judy/api/client.rb', line 18 def collection(type) Collection.new(root.subresource(type), type) end |
#escalation_policies ⇒ Object
22 23 24 |
# File 'lib/pager_judy/api/client.rb', line 22 def escalation_policies collection("escalation_policies") end |
#extensions ⇒ Object
26 27 28 |
# File 'lib/pager_judy/api/client.rb', line 26 def extensions collection("extensions") end |
#incidents ⇒ Object
30 31 32 |
# File 'lib/pager_judy/api/client.rb', line 30 def incidents collection("incidents") end |
#log_entries ⇒ Object
34 35 36 |
# File 'lib/pager_judy/api/client.rb', line 34 def log_entries collection("log_entries") end |
#notifications ⇒ Object
38 39 40 |
# File 'lib/pager_judy/api/client.rb', line 38 def notifications collection("notifications") end |
#oncalls ⇒ Object
42 43 44 |
# File 'lib/pager_judy/api/client.rb', line 42 def oncalls collection("oncalls") end |
#schedules ⇒ Object
46 47 48 |
# File 'lib/pager_judy/api/client.rb', line 46 def schedules collection("schedules") end |
#services ⇒ Object
50 51 52 |
# File 'lib/pager_judy/api/client.rb', line 50 def services collection("services") end |
#teams ⇒ Object
54 55 56 |
# File 'lib/pager_judy/api/client.rb', line 54 def teams collection("teams") end |
#users ⇒ Object
58 59 60 |
# File 'lib/pager_judy/api/client.rb', line 58 def users collection("users") end |
#vendors ⇒ Object
62 63 64 |
# File 'lib/pager_judy/api/client.rb', line 62 def vendors collection("vendors") end |