zenduty 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +14 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/zenduty.rb +9 -0
- data/lib/zenduty/api.rb +37 -0
- data/lib/zenduty/escalationpolicies_api.rb +60 -0
- data/lib/zenduty/events_api.rb +25 -0
- data/lib/zenduty/incidents_api.rb +69 -0
- data/lib/zenduty/integrations_api.rb +45 -0
- data/lib/zenduty/members_api.rb +26 -0
- data/lib/zenduty/schedules_api.rb +59 -0
- data/lib/zenduty/services_api.rb +60 -0
- data/lib/zenduty/teams_api.rb +36 -0
- data/lib/zenduty/version.rb +3 -0
- data/zenduty.gemspec +42 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c6742addbda2b509612c1c814f576ea1db9157c
|
4
|
+
data.tar.gz: dab079628931138fbaec4c2df89b30319e82cbe1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46df1de73ac21608269dd22915a473bf6a465fc5e76b37aedcea82b281678718aebdc8b90f372dada8746503f186d81a2235fc322d9fa90886850d66f52d03b2
|
7
|
+
data.tar.gz: e77db5770cb106ed89f3bcceed8d2bd29f13f1c52665e2dfc75ada659cfba6c3c374d42e72a31e4f48a6f6922e2689bbda2c1c2115acc6b0e6e004ec820d00d6
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at amodhshenoy@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 AmodhShenoy
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Zenduty Ruby SDK
|
2
|
+
Ruby SDK to communicate with Zenduty API endpoints
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Run this on the terminal to begin installation
|
6
|
+
```
|
7
|
+
$ gem install zenduty
|
8
|
+
```
|
9
|
+
|
10
|
+
## License
|
11
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
12
|
+
|
13
|
+
## Code of Conduct
|
14
|
+
Everyone interacting in the Zenduty project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/zenduty/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "zenduty"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/zenduty.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require_relative "zenduty/teams_api"
|
2
|
+
require_relative "zenduty/services_api"
|
3
|
+
require_relative "zenduty/escalationpolicies_api"
|
4
|
+
require_relative "zenduty/events_api"
|
5
|
+
require_relative "zenduty/incidents_api"
|
6
|
+
require_relative "zenduty/integrations_api"
|
7
|
+
require_relative "zenduty/members_api"
|
8
|
+
require_relative "zenduty/schedules_api"
|
9
|
+
require_relative "zenduty/version"
|
data/lib/zenduty/api.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
#require_relative "exceptions"
|
4
|
+
#require_relative "message/message_class"
|
5
|
+
|
6
|
+
module Zenduty
|
7
|
+
include HTTParty
|
8
|
+
|
9
|
+
class APIClient
|
10
|
+
|
11
|
+
def initialize(access_token)
|
12
|
+
@api_url = "https://www.zenduty.com"
|
13
|
+
@access_token = access_token
|
14
|
+
end
|
15
|
+
|
16
|
+
def _get(endpoint,body={})
|
17
|
+
header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"}
|
18
|
+
HTTParty.get(@api_url+endpoint, body:body.to_json, headers: header )
|
19
|
+
end
|
20
|
+
|
21
|
+
def _post(endpoint, body={})
|
22
|
+
#print body
|
23
|
+
header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"}
|
24
|
+
HTTParty.post(@api_url+endpoint, body: body.to_json, headers: header)
|
25
|
+
end
|
26
|
+
|
27
|
+
def _patch(endpoint, body={})
|
28
|
+
header = {'Content-type'=> "application/json", "Authorization"=>"Token #{@access_token}"}
|
29
|
+
HTTParty.patch(@api_url+endpoint, body: body.to_json, headers: header)
|
30
|
+
end
|
31
|
+
|
32
|
+
def _delete(endpoint, body={})
|
33
|
+
header = {"Content-type"=>"application/json","Authorization"=>"Token #{@access_token}"}
|
34
|
+
HTTParty.delete(@api_url+endpoint, body:body.to_json, headers:header)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class EscalationPoliciesApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_escalation_policies(team_id)
|
11
|
+
#Returns the escalation policies belonging to one team
|
12
|
+
#params str team_id=> unique id of team
|
13
|
+
@api._get("/api/account/teams/#{team_id}/escalation_policies/")
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_escalation_policy(team_id,body)
|
17
|
+
#Creates an escalation policy for one team
|
18
|
+
#params str team_id=> unique id of team
|
19
|
+
#params hash body=> contains the required details for creating escalation policy
|
20
|
+
#Sample body=>
|
21
|
+
# {'name'=>name,
|
22
|
+
# 'summary'=>summary,
|
23
|
+
# 'description'=>description,
|
24
|
+
# 'rules'=>rules,
|
25
|
+
# 'unique_id'=>unique_id,
|
26
|
+
# 'team'=>team_id}
|
27
|
+
@api._post("/api/account/teams/#{team_id}/escalation_policies/",body)
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_escalation_policy_by_id(team_id,ep_id)
|
31
|
+
#Returns escalation_policy identified by id
|
32
|
+
#params str team_id=> unique id of team
|
33
|
+
#params str ep_id=> unique id of escalation policy
|
34
|
+
@api._get("/api/account/teams/#{team_id}/escalation_policies/#{ep_id}/")
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_escalation_policy(team_id,ep_id,body)
|
38
|
+
#Updates escalation policy, identified by id
|
39
|
+
#params str team_id=> unique id of team
|
40
|
+
#params str ep_id=> unqiue id of escalation policy
|
41
|
+
#params hash body=> contains all the updated values
|
42
|
+
# 'rules' is a required part of the body
|
43
|
+
#Sample body=>
|
44
|
+
# body={'summary'=>'changes description',
|
45
|
+
# 'rules'=>[{"delay"=>1,
|
46
|
+
# "targets"=>[{"target_type"=>2,
|
47
|
+
# "target_id"+."826032d6-7ccd-4d58-b114-f"}],
|
48
|
+
# "position"=>1,
|
49
|
+
# "unique_id"=>"c0dad09b-321b-491e-9c23-f816c7bd0339"}]}
|
50
|
+
@api._patch("/api/account/teams/#{team_id}/escalation_policies/#{ep_id}/",body)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete_escalation_policy(team_id,ep_id)
|
54
|
+
#Deletes escalation policy, identified by id
|
55
|
+
#params str team_id=> unique id of team
|
56
|
+
#params str ep_id=> unique id of escalation policy
|
57
|
+
@api._delete("/api/account/teams/#{team_id}/escalation_policies/#{ep_id}/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
class EventsApi
|
5
|
+
def initialize(access_token)
|
6
|
+
@api = APIClient.new(access_token)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_event(integration_key,body)
|
10
|
+
#Creates an incident event on zenduty
|
11
|
+
#params str integration_key=> unique key provided for your integration
|
12
|
+
#params hash body=> contains the details of the event
|
13
|
+
# 'message', 'summary' are required fields of the body
|
14
|
+
# 'alert_type' is "info" by default
|
15
|
+
# 'suppressed' is false by default
|
16
|
+
# if no entity_id is provided, Zenduty provides one automatically
|
17
|
+
# Sample body=>
|
18
|
+
# {'message'=>message,
|
19
|
+
# 'summary'=>summary,
|
20
|
+
# 'alert_type'=>alert_type,
|
21
|
+
# 'supressed'=>supressed}
|
22
|
+
@api._post("/api/events/#{integration_key}/",body)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class IncidentsApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_incidents(body)
|
11
|
+
#Returns the incidents from your zenduty account
|
12
|
+
#params hash body=> contains all the required details of your account
|
13
|
+
# Sample body=>
|
14
|
+
# {'page'=>1,
|
15
|
+
# 'status'=>5,
|
16
|
+
# 'team_id'=>['a2c6322b-4c1b-4884-8f7a-a7f270de98cb'],
|
17
|
+
# 'service_ids'=>[],
|
18
|
+
# 'user_ids'=>[]}
|
19
|
+
@api._get("/api/incidents/",body)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_incidents_by_number(incident_number)
|
23
|
+
#Returns the incidents belonging to a given incident number
|
24
|
+
#params int incident_number=> incident number of event
|
25
|
+
@api._get("/api/incidents/#{incident_number}/")
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_incident_alerts(incident_number)
|
29
|
+
#Returns all alerts of a particular incident
|
30
|
+
#params int incident_number=> incident number of event
|
31
|
+
@api._get("/api/incidents/#{incident_number}/alerts/")
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_incident_notes(incident_number)
|
35
|
+
#Gets the notes regarding an incident, identified by incident number
|
36
|
+
#params int incident_number=> incident number of event
|
37
|
+
@api._get("/api/incidents/#{incident_number}/note/")
|
38
|
+
end
|
39
|
+
|
40
|
+
def acknowledge_or_resolve_incidents(incident_number,body)
|
41
|
+
#Used to acknowledge or resolve incident, identified by incident number
|
42
|
+
#params str incident_number=> incident number of event
|
43
|
+
#params hash body=> contains the changed values of incident
|
44
|
+
# Sample body=>
|
45
|
+
# {'status'=>3,
|
46
|
+
# 'incident_number'=>12}
|
47
|
+
@api._patch("/api/incidents/#{incident_number}/",body)
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_incident(body)
|
51
|
+
#Used to create an incident for a particular service, identified by id
|
52
|
+
#params hash body=> contains necessary details for creating incident
|
53
|
+
# Sample body=>
|
54
|
+
# {"service"=>"c7fff4c5-2def-41e8-9120-c63f649a825c",
|
55
|
+
# "escalation_policy"=>"a70244c8-e343-4dd0-8d87-2f767115568a",
|
56
|
+
# "user"=>null,
|
57
|
+
# "title"=>"Name of trial",
|
58
|
+
# "summary"=>"summary of trial"}
|
59
|
+
# escalation_policy,service, title and summary are required fields.
|
60
|
+
# if escalation_policy is not set (set to None then), then assigned_to is required, as follows
|
61
|
+
# {"service"=>"b1559a26-c51f-45a1-886d-f6caeaf0fc7e",
|
62
|
+
# "escalation_policy"=>null,
|
63
|
+
# "assigned_to"=>"826032d6-7ccd-4d58-b114-f",
|
64
|
+
# "title"=>"Name of trial",
|
65
|
+
# "summary"=>"Summary of trial"}
|
66
|
+
@api._post("/api/incidents/",body)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class IntegrationsApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_integrations_in_service(team_id,service_id)
|
11
|
+
#Returns the integrations in a service
|
12
|
+
#params str team_id=> unique id of team
|
13
|
+
#params str service_id=> unique id of service
|
14
|
+
@api._get("/api/account/teams/#{team_id}/services/#{service_id}/integrations/")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_integration(team_id,service_id,body)
|
18
|
+
#Creates a new integration for a given service in a team
|
19
|
+
#params str team_id=> unique id of team
|
20
|
+
#params str service_id=> unique id of service
|
21
|
+
#params hash body=> contains the details of the new integration
|
22
|
+
# Sample body=>
|
23
|
+
# {"name"=>"asdf",
|
24
|
+
# "summary"=>"asdf",
|
25
|
+
# "application"=>"27c9800c-2856-490d-8119-790be1308dd4"}
|
26
|
+
@api._post("/api/account/teams/#{team_id}/services/#{service_id}/integrations/",body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_integrations_by_id(team_id,service_id,integration_id)
|
30
|
+
#Returns an integration belonging to a service in a team, identified by id
|
31
|
+
#params str team_id=> unique id of team
|
32
|
+
#params str service_id=> unique id of service
|
33
|
+
#params str integration_id=> unique id of integration
|
34
|
+
@api._get("/api/account/teams/#{team_id}/services/#{service_id}/integrations/#{integration_id}/")
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_alerts_in_integration(team_id,service_id,integration_id)
|
38
|
+
#Returns alerts in a particular integration
|
39
|
+
#params str team_id=> unique id of team
|
40
|
+
#params str service_id=> unique id of service
|
41
|
+
#params str integration_id=> unique id of integration
|
42
|
+
@api._get("/api/account/teams/#{team_id}/services/#{service_id}/integrations/#{integration_id}/alerts/")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class MembersApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_members_to_team(team_id,body)
|
11
|
+
#Adds a member to a given team, identified by id
|
12
|
+
#params str team_id=> unique id of team
|
13
|
+
#params hash body=> contains the details of the user being added and the team to add to
|
14
|
+
#Sample body=>
|
15
|
+
# {"team"=>"d4a777db-5bce-419c-a725-420ebb505c54","user"=>"af9eeb60-5acb-406c-971e-3"}
|
16
|
+
@api._post("/api/account/teams/#{team_id}/members/",body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_members_from_team(team_id,member_id)
|
20
|
+
#Removes a member from a particular team
|
21
|
+
#params str team_id=> unique id of a team
|
22
|
+
#params str member_id=> unique id of member to be deleted
|
23
|
+
@api._delete("/api/account/teams/#{team_id}/members/#{member_id}/")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class SchedulesApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_schedules(team_id)
|
11
|
+
#Returns the schedules in a particular team, identified by id
|
12
|
+
#params str team_id=> unique id of a team
|
13
|
+
@api._get("/api/account/teams/#{team_id}/schedules/")
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_schedules(team_id,body)
|
17
|
+
#Creates a schedule for a team
|
18
|
+
#params str team_id=> unique id of team
|
19
|
+
#params hash body=> contains the details of the schedule to be created
|
20
|
+
#Sample body=>
|
21
|
+
#{"name"=>"Name of schedule",
|
22
|
+
# "summary"=>"summar of schedule",
|
23
|
+
# "time_zone"=>"Asia/Kolkata",
|
24
|
+
# "team"=>"d4a777db-5bce-419c-a725-420ebb505c54",
|
25
|
+
# "layers"=>[]}
|
26
|
+
@api._post("/api/account/teams/#{team_id}/schedules/",body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_schedule_by_id(team_id,schedule_id)
|
30
|
+
#Returns a particular schedule from a team, identifed by id
|
31
|
+
#params str team_id=> unique id of a team
|
32
|
+
#params schedule_id=> unique id of schedule
|
33
|
+
@api._get("/api/account/teams/#{team_id}/schedules/#{schedule_id}/")
|
34
|
+
end
|
35
|
+
|
36
|
+
def update_schedules(team_id,schedule_id, body)
|
37
|
+
#Updates the schedule details for a given team, identified by id
|
38
|
+
#params str team_id=> unique id of a team
|
39
|
+
#params str schedul_id=> unique id of schedule
|
40
|
+
#params hash body=> contains the updated values of schedule
|
41
|
+
# 'unique_id' and 'team' are required. Other fields are just those which have been changed
|
42
|
+
#Sample body=>
|
43
|
+
#{"name"=>"Name of schedule",
|
44
|
+
# "summary"=>"summar of schedule",
|
45
|
+
# "time_zone"=>"Asia/Kamchatka",
|
46
|
+
# "team"=>"d4a777db-5bce-419c-a725-420ebb505c54",
|
47
|
+
# "unique_id"=>"f9b34bd3-818a-4b98-9d8a-04d8bd501cd0",
|
48
|
+
# "layers"=>[]}
|
49
|
+
@api._patch("/api/account/teams/#{team_id}/schedules/#{schedule_id}/",body)
|
50
|
+
end
|
51
|
+
|
52
|
+
def delete_schedule(team_id,schedule_id)
|
53
|
+
#Deletes a schedule from a team
|
54
|
+
#params str team_id=>unique id of team
|
55
|
+
#params str schedule_id=> unique id of schedule
|
56
|
+
@api._delete("/api/account/teams/#{team_id}/schedules/#{schedule_id}/")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class ServicesApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_service_for_team(team_id)
|
11
|
+
#Returns all the services in a team
|
12
|
+
#params str team_id=> unnique id of team
|
13
|
+
@api._get("/api/account/teams/#{team_id}/services/")
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_new_service_in_team(team_id,body)
|
17
|
+
#Adds a new servie to a give team, identified by id
|
18
|
+
#params str team_id=> unique id of team
|
19
|
+
#params hash body=> contains the details of the new service to be added
|
20
|
+
#Sample body
|
21
|
+
#{"name"=>"Name of service",
|
22
|
+
# "description"=>"Description of service",
|
23
|
+
# "integrations"=>[{"application"=>"27c9800c-2856-490d-8119-790be1308dd4",
|
24
|
+
# "name"=>"API",
|
25
|
+
# "summary"=>"Edit summary for this integration"}],
|
26
|
+
# "escalation_policy"=>"5c9b6288-c105-418d-970b-91a93d0e919a",
|
27
|
+
# "acknowledgement_timeout"=>1,
|
28
|
+
# "auto_resolve_timeout"=>1}
|
29
|
+
@api._post("/api/account/teams/#{team_id}/services/",body)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_services_by_id(team_id,service_id)
|
33
|
+
#Returns a particular service from a team, identified by id
|
34
|
+
#params str team_id=> unique id of team
|
35
|
+
#params str service_id=> unique id of service
|
36
|
+
@api._get("/api/account/teams/#{team_id}/services/#{service_id}/")
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_service(team_id,service_id,body)
|
40
|
+
#Updates the existing service in a team
|
41
|
+
#params str team_id=> unique id of team
|
42
|
+
#params str service_id=> unique id of service
|
43
|
+
#params hash body=> contains the updated details of services
|
44
|
+
#Sample body=>
|
45
|
+
#{"unique_id"=>"bc808ce3-46c0-41d0-bf1f-f405fdd0c1c3",
|
46
|
+
# "auto_resolve_timeout"=>0,
|
47
|
+
# "acknowledgement_timeout"=>0,
|
48
|
+
# "status"=>1,
|
49
|
+
# "escalation_policy"=>"5c9b6288-c105-418d-970b-91a93d0e919a"}
|
50
|
+
@api._patch("/api/account/teams/#{team_id}/services/#{service_id}/",body)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete_service_from_team(team_id,service_id)
|
54
|
+
#Deletes a particular service from a team
|
55
|
+
#params str team_id=> unique id of team
|
56
|
+
#params str service_id=> unnique id of service
|
57
|
+
@api._delete("/api/account/teams/#{team_id}/services/#{service_id}/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative "api"
|
2
|
+
|
3
|
+
module Zenduty
|
4
|
+
|
5
|
+
class TeamsApi
|
6
|
+
def initialize(access_token)
|
7
|
+
@api = APIClient.new(access_token)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_teams()
|
11
|
+
#Returns all the teams and their details from your Zenduty account
|
12
|
+
@api._get("/api/account/teams/")
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_team(body)
|
16
|
+
#Creates a new team for your zenduty account
|
17
|
+
#params hash bodyhash contains the details for your new team
|
18
|
+
#Sample bodyhash
|
19
|
+
# 'name' is a required field
|
20
|
+
# {'name'=>name}
|
21
|
+
@api._post("/api/account/teams/",body)
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_team_details(team_id)
|
25
|
+
#Returns a team form your zenduty acocunt, identified by id
|
26
|
+
# params str team_idhash unique id of team
|
27
|
+
@api._get("/api/account/teams/#{team_id}/")
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete_team(team_id)
|
31
|
+
#Deletes a team form your zenduty account
|
32
|
+
#params str team_idhash unique id of team
|
33
|
+
@api._delete("/api/account/teams/#{team_id}/")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/zenduty.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "zenduty/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zenduty"
|
8
|
+
spec.version = Zenduty::VERSION
|
9
|
+
spec.authors = ["Vishwa Krishnakumar"]
|
10
|
+
spec.email = ["vishwa@yellowant.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby SDK to communicate with Zenduty API}
|
13
|
+
spec.description = %q{Ruby SDK to communicate with Zenduty API}
|
14
|
+
spec.homepage = "https://apidocs.zenduty.com/"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
|
22
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
24
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
25
|
+
# else
|
26
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
# "public gem pushes."
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ["lib"]
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "httparty"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zenduty
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vishwa Krishnakumar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Ruby SDK to communicate with Zenduty API
|
56
|
+
email:
|
57
|
+
- vishwa@yellowant.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CODE_OF_CONDUCT.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/zenduty.rb
|
71
|
+
- lib/zenduty/api.rb
|
72
|
+
- lib/zenduty/escalationpolicies_api.rb
|
73
|
+
- lib/zenduty/events_api.rb
|
74
|
+
- lib/zenduty/incidents_api.rb
|
75
|
+
- lib/zenduty/integrations_api.rb
|
76
|
+
- lib/zenduty/members_api.rb
|
77
|
+
- lib/zenduty/schedules_api.rb
|
78
|
+
- lib/zenduty/services_api.rb
|
79
|
+
- lib/zenduty/teams_api.rb
|
80
|
+
- lib/zenduty/version.rb
|
81
|
+
- zenduty.gemspec
|
82
|
+
homepage: https://apidocs.zenduty.com/
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.5.2.3
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Ruby SDK to communicate with Zenduty API
|
106
|
+
test_files: []
|