Class: PagerJudy::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pager_judy/api/client.rb

Overview

Communicate with the PagerDuty API.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rootObject (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_policiesObject



22
23
24
# File 'lib/pager_judy/api/client.rb', line 22

def escalation_policies
  collection("escalation_policies")
end

#extensionsObject



26
27
28
# File 'lib/pager_judy/api/client.rb', line 26

def extensions
  collection("extensions")
end

#incidentsObject



30
31
32
# File 'lib/pager_judy/api/client.rb', line 30

def incidents
  collection("incidents")
end

#log_entriesObject



34
35
36
# File 'lib/pager_judy/api/client.rb', line 34

def log_entries
  collection("log_entries")
end

#notificationsObject



38
39
40
# File 'lib/pager_judy/api/client.rb', line 38

def notifications
  collection("notifications")
end

#oncallsObject



42
43
44
# File 'lib/pager_judy/api/client.rb', line 42

def oncalls
  collection("oncalls")
end

#schedulesObject



46
47
48
# File 'lib/pager_judy/api/client.rb', line 46

def schedules
  collection("schedules")
end

#servicesObject



50
51
52
# File 'lib/pager_judy/api/client.rb', line 50

def services
  collection("services")
end

#teamsObject



54
55
56
# File 'lib/pager_judy/api/client.rb', line 54

def teams
  collection("teams")
end

#usersObject



58
59
60
# File 'lib/pager_judy/api/client.rb', line 58

def users
  collection("users")
end

#vendorsObject



62
63
64
# File 'lib/pager_judy/api/client.rb', line 62

def vendors
  collection("vendors")
end