ticket_abstractor_client 1.29.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +199 -159
  3. data/lib/ticket_abstractor_client.rb +11 -39
  4. data/lib/ticket_abstractor_client/base/attachment.rb +52 -0
  5. data/lib/ticket_abstractor_client/base/client.rb +54 -0
  6. data/lib/ticket_abstractor_client/base/comment.rb +35 -0
  7. data/lib/ticket_abstractor_client/base/errors.rb +25 -0
  8. data/lib/ticket_abstractor_client/base/fields_filter.rb +15 -0
  9. data/lib/ticket_abstractor_client/base/response_handler.rb +28 -0
  10. data/lib/ticket_abstractor_client/base/ticket.rb +79 -0
  11. data/lib/ticket_abstractor_client/client_helper.rb +29 -0
  12. data/lib/ticket_abstractor_client/configuration.rb +61 -0
  13. data/lib/ticket_abstractor_client/jira/attachment.rb +42 -0
  14. data/lib/ticket_abstractor_client/jira/client.rb +83 -0
  15. data/lib/ticket_abstractor_client/jira/comment.rb +35 -0
  16. data/lib/ticket_abstractor_client/jira/errors.rb +25 -0
  17. data/lib/ticket_abstractor_client/jira/fields_meta.rb +36 -0
  18. data/lib/ticket_abstractor_client/jira/params_builder.rb +96 -0
  19. data/lib/ticket_abstractor_client/jira/ticket.rb +131 -0
  20. data/lib/ticket_abstractor_client/service_now/attachment.rb +41 -0
  21. data/lib/ticket_abstractor_client/service_now/client.rb +78 -0
  22. data/lib/ticket_abstractor_client/service_now/comment.rb +30 -0
  23. data/lib/ticket_abstractor_client/service_now/errors.rb +25 -0
  24. data/lib/ticket_abstractor_client/service_now/params_builder.rb +56 -0
  25. data/lib/ticket_abstractor_client/service_now/ticket.rb +120 -0
  26. data/lib/ticket_abstractor_client/version.rb +1 -1
  27. metadata +52 -9
  28. data/lib/ticket_abstractor_client/brouha_client.rb +0 -33
  29. data/lib/ticket_abstractor_client/client.rb +0 -31
  30. data/lib/ticket_abstractor_client/i_logger_client.rb +0 -5
  31. data/lib/ticket_abstractor_client/itrc_client.rb +0 -33
  32. data/lib/ticket_abstractor_client/jira_client.rb +0 -128
  33. data/lib/ticket_abstractor_client/service_now_client.rb +0 -61
  34. data/lib/ticket_abstractor_client/sev_one_client.rb +0 -21
@@ -1,33 +0,0 @@
1
- class TicketAbstractorClient::BrouhaClient < TicketAbstractorClient::Client
2
- def get_issue(issue_key)
3
- get "ticket/brouha/#{issue_key}"
4
- end
5
-
6
- def create_issue(params = {})
7
- post "ticket/brouha", params
8
- end
9
-
10
- def update_issue(issue_key, params = {})
11
- patch "ticket/brouha/#{issue_key}", params
12
- end
13
-
14
- def list_product_services(params = {})
15
- get 'brouha/list_product_services', params
16
- end
17
-
18
- def get_incidents_by_query(query_params)
19
- get 'brouha/incidents', { query_params: query_params }
20
- end
21
-
22
- def add_application(issue_key, application_ids)
23
- post 'brouha/add_application', issue_key: issue_key, application_ids: application_ids
24
- end
25
-
26
- def add_device(issue_key, device_fqdns)
27
- post 'brouha/add_device', issue_key: issue_key, fqdns: device_fqdns
28
- end
29
-
30
- def get_incident_desks
31
- get 'brouha/get_incident_desks'
32
- end
33
- end
@@ -1,31 +0,0 @@
1
- class TicketAbstractorClient::Client
2
- def initialize(base_url, security_token = nil)
3
- @base_url = base_url
4
- @security_token = security_token
5
- end
6
-
7
- def get(url, args = {}, params = {})
8
- params.merge! args: args.to_json, security_token: @security_token
9
- response = RestClient.get("#{@base_url}/#{url}", params: params)
10
-
11
- if response.headers[:file_request]
12
- response
13
- else
14
- JSON.parse response
15
- end
16
- end
17
-
18
- def post(url, args = {}, params = {})
19
- params.merge! args: args.to_json, security_token: @security_token
20
- response = RestClient.post("#{@base_url}/#{url}", params)
21
-
22
- JSON.parse response
23
- end
24
-
25
- def patch(url, args = {}, params = {})
26
- params.merge! args: args.to_json, security_token: @security_token
27
- response = RestClient.patch("#{@base_url}/#{url}", params)
28
-
29
- JSON.parse response
30
- end
31
- end
@@ -1,5 +0,0 @@
1
- class TicketAbstractorClient::ILoggerClient < TicketAbstractorClient::Client
2
- def get_incidents(query_params)
3
- get 'ilogger/incidents', { query_params: query_params }
4
- end
5
- end
@@ -1,33 +0,0 @@
1
- class TicketAbstractorClient::ItrcClient < TicketAbstractorClient::Client
2
- def list_apps(page = 1, per_page = 20)
3
- get 'itrc/list_apps', page: page, per_page: per_page
4
- end
5
-
6
- def find_app(id)
7
- get 'itrc/find_app', id: id
8
- end
9
-
10
- def list_app_groups(page = 1, per_page = 20)
11
- get 'itrc/list_app_groups', page: page, per_page: per_page
12
- end
13
-
14
- def find_app_group(id)
15
- get 'itrc/find_app_group', id: id
16
- end
17
-
18
- def list_business_units(page = 1, per_page = 20)
19
- get 'itrc/list_business_units', page: page, per_page: per_page
20
- end
21
-
22
- def find_business_unit(id)
23
- get 'itrc/find_business_unit', id: id
24
- end
25
-
26
- def list_departments(page = 1, per_page = 20)
27
- get 'itrc/list_departments', page: page, per_page: per_page
28
- end
29
-
30
- def find_department(id)
31
- get 'itrc/find_department', id: id
32
- end
33
- end
@@ -1,128 +0,0 @@
1
- class TicketAbstractorClient::JiraClient < TicketAbstractorClient::Client
2
-
3
- def initialize(base_url, security_token = nil, endpoint = 'tp')
4
- super base_url, security_token
5
- @jira_endpoint = endpoint
6
- end
7
-
8
- def get_with_endpoint(url, args = {}, params = {})
9
- params.merge! jira_endpoint: @jira_endpoint
10
- get url, args, params
11
- end
12
-
13
- def post_with_endpoint(url, args = {}, params = {})
14
- params.merge! jira_endpoint: @jira_endpoint
15
- post url, args, params
16
- end
17
-
18
- ##
19
- # Get jira endpoints list
20
- #
21
- # == Example:
22
- # >> client.jira.endpoints
23
- # => { "tp" => "https://www.example.com/jira", "io" => "..." }
24
- def endpoints
25
- get 'jira/endpoints'
26
- end
27
-
28
- ##
29
- # Get jira raw issue by issue id
30
- #
31
- # == Parameters:
32
- # issue_key:
33
- # issue id in jira
34
- #
35
- # == Example:
36
- # >> client.jira.raw_get_issue 'IFS-123'
37
- # => {"id"=>"433537", "self"=>"https://www.teamccp.com/jira/rest/api/2/issue/433537", "key"=>"IFS-123", "fields"=>{"summary"=>"...", "issuetype"=>{...}}
38
- def raw_get_issue(issue_key)
39
- get_with_endpoint "jira/raw_get_issue", { issue_key: issue_key }, raw_request: true
40
- end
41
-
42
- ##
43
- # Get jira issue by issue id
44
- #
45
- # == Parameters:
46
- # issue_key:
47
- # issue id in jira
48
- #
49
- # == Example:
50
- # >> client.jira.get_issue 'IFS-123'
51
- # => { 'id' => 'IFS-123', 'description' => '...', ... }
52
- def get_issue(issue_key)
53
- get_with_endpoint "ticket/jira/#{issue_key}"
54
- end
55
-
56
- ##
57
- # Get the status of jira issue by issue id
58
- #
59
- # == Parameters:
60
- # issue_key:
61
- # issue id in jira
62
- #
63
- # == Example:
64
- # >> client.jira.get_issue_status 'IFS-123'
65
- # => 'Resolved'
66
- def get_issue_status(issue_key)
67
- get_issue(issue_key)['status']
68
- end
69
-
70
- def get_issues_by_jql(query, params: {})
71
- get_with_endpoint 'jira/get_issues_by_jql', query: query, params: params
72
- end
73
-
74
- def get_issues_by_query(query)
75
- get_with_endpoint "jira_v1/get_issues_by_query", query: query
76
- end
77
-
78
- def get_issues_statuses_by_search_query(issues_id)
79
- get_with_endpoint 'jira/get_issues_statuses_by_search_query', issues_id: issues_id
80
- end
81
-
82
- def get_fields_by_project(project_key)
83
- get_with_endpoint 'jira/get_fields_by_project', project_key: project_key
84
- end
85
-
86
- def get_all_fields
87
- get_with_endpoint 'jira/get_all_fields'
88
- end
89
-
90
- def download_attachment(attachment_id, attachment_name)
91
- get_with_endpoint(
92
- 'jira/download_attachment',
93
- { attachment_id: attachment_id, attachment_name: attachment_name }
94
- )
95
- end
96
-
97
- def create_issue(opts = {}, *attachments)
98
- post_with_endpoint 'jira/create_issue', { opts: opts }, attachments: attachments
99
- end
100
-
101
- def raw_create_issue(opts = {}, *attachments)
102
- post_with_endpoint 'jira/raw_create_issue', { opts: opts }, attachments: attachments, raw_request: true
103
- end
104
-
105
- def raw_update_issue(opts = {}, *attachments)
106
- post_with_endpoint 'jira/raw_update_issue', { opts: opts }, attachments: attachments, raw_request: true
107
- end
108
-
109
- def create_tvx_issue(opts = {})
110
- post_with_endpoint 'ticket/jira', opts
111
- end
112
-
113
- def update_issue(opts = {}, *attachments)
114
- post_with_endpoint 'jira/update_issue', { opts: opts }, attachments: attachments
115
- end
116
-
117
- def add_comment(issue_key, comment)
118
- post_with_endpoint 'jira/add_comment', issue_key: issue_key, comment: comment
119
- end
120
-
121
- def transitions_list(issue_key)
122
- get_with_endpoint 'jira/transitions_list', issue_key: issue_key
123
- end
124
-
125
- def transit_issue(issue_key, transition_params)
126
- post_with_endpoint 'jira/transit_issue', issue_key: issue_key, transition_params: transition_params
127
- end
128
- end
@@ -1,61 +0,0 @@
1
- class TicketAbstractorClient::ServiceNowClient < TicketAbstractorClient::Client
2
- def initialize(base_url, security_token = nil, endpoint = 'default')
3
- super base_url, security_token
4
- @service_now_endpoint = endpoint
5
- end
6
-
7
- def endpoints
8
- get 'service_now/endpoints'
9
- end
10
-
11
- def get_all_incidents(params = {})
12
- get_with_endpoint 'service_now/get_all_incidents', params
13
- end
14
-
15
- def get_incidents_by_query(params)
16
- get_with_endpoint 'service_now/get_incidents_by_query', params
17
- end
18
-
19
- def get_attachments(params)
20
- get_with_endpoint 'service_now/get_attachments', params
21
- end
22
-
23
- def get_comments(params)
24
- get_with_endpoint 'service_now/get_comments', params
25
- end
26
-
27
- def get_incident(params)
28
- get_with_endpoint 'service_now/get_incident', params
29
- end
30
-
31
- def create_attachment(params)
32
- post_with_endpoint 'service_now/create_attachment', params
33
- end
34
-
35
- def create_incident(params)
36
- post_with_endpoint 'service_now/create_incident', params
37
- end
38
-
39
- def update_incident(params)
40
- post_with_endpoint 'service_now/update_incident', params
41
- end
42
-
43
- def get_stats(params)
44
- get_with_endpoint 'service_now/get_stats', params
45
- end
46
-
47
- def get_all_groups(params = {})
48
- get_with_endpoint 'service_now/get_all_groups', params
49
- end
50
-
51
- protected
52
- def get_with_endpoint(url, args={}, params={})
53
- params.merge! service_now_endpoint: @service_now_endpoint
54
- get url, args, params
55
- end
56
-
57
- def post_with_endpoint(url, args={}, params={})
58
- params.merge! service_now_endpoint: @service_now_endpoint
59
- post url, args, params
60
- end
61
- end
@@ -1,21 +0,0 @@
1
- class TicketAbstractorClient::SevOneClient < TicketAbstractorClient::Client
2
- def report_get_data_from_graph(params)
3
- get 'sev_one/report_get_data_from_graph', params
4
- end
5
-
6
- def flowfalcon_get_data_from_graph(params)
7
- get 'sev_one/flowfalcon_get_data_from_graph', params
8
- end
9
-
10
- def core_get_objects_by_device_id(params)
11
- get 'sev_one/core_get_objects_by_device_id', params
12
- end
13
-
14
- def core_get_device_id_by_name(params)
15
- get 'sev_one/core_get_device_id_by_name', params
16
- end
17
-
18
- def get_indicators(params)
19
- get 'sev_one/get_indicators', params
20
- end
21
- end