ticket_abstractor_client 1.23.0 → 1.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eec3f0b3a318168548a996e24c8d9cca5b9ad4de
4
- data.tar.gz: 7e1ff26ce37dbea1d3fbc89d0be515c7b7f94cf5
3
+ metadata.gz: 6c1da81a66687d51774ac816ed8bd808ffa50b99
4
+ data.tar.gz: a83e15379fb54fe2f1c22039a0fc576b680f9329
5
5
  SHA512:
6
- metadata.gz: 0ff54c8c4a365f97a90749af21e732d5a2f4ce74e0732ceeb13bb4c43b6ab1416a09f34deb10ca0a41d358897ac7a5aba849f1f02abb07d3deb96efe84e84eec
7
- data.tar.gz: 57e6d15bec123997f7d4162aec313afe5f252dd2477b435c1a2926cf5897bd14f5a593bff92ea597bbae92ba42357580c07a6ec9c36fca661ebe1e04bcc8fd39
6
+ metadata.gz: f2e772acbf491c15d976d38a6a6c642c2aa7ecd7f75972d515d882fd3dc3dffaf72415402b97e7b265ec11253034dcd2a3dcceb6c81a9019f119f43b2c6d715d
7
+ data.tar.gz: 17303292863c487d436451e1773d8ca9fea02ff4f208f783f9f3c91344ea464d1c9184a36e5fdb8c2b278c23f671d0aaec75209bb713923d77762d95764cfcf5
@@ -1,29 +1,49 @@
1
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
+
2
11
  def get_all_incidents(params = {})
3
- get 'service_now/get_all_incidents', params
12
+ get_with_endpoint 'service_now/get_all_incidents', params
4
13
  end
5
14
 
6
15
  def get_incidents_by_query(params)
7
- get 'service_now/get_incidents_by_query', params
16
+ get_with_endpoint 'service_now/get_incidents_by_query', params
8
17
  end
9
18
 
10
19
  def get_attachments(params)
11
- get 'service_now/get_attachments', params
20
+ get_with_endpoint 'service_now/get_attachments', params
12
21
  end
13
22
 
14
23
  def get_incident(params)
15
- get 'service_now/get_incident', params
24
+ get_with_endpoint 'service_now/get_incident', params
16
25
  end
17
26
 
18
27
  def create_attachment(params)
19
- post 'service_now/create_attachment', params
28
+ post_with_endpoint 'service_now/create_attachment', params
20
29
  end
21
30
 
22
31
  def create_incident(params)
23
- post 'service_now/create_incident', params
32
+ post_with_endpoint 'service_now/create_incident', params
24
33
  end
25
34
 
26
35
  def update_incident(params)
27
- post 'service_now/update_incident', params
36
+ post_with_endpoint 'service_now/update_incident', params
28
37
  end
38
+
39
+ protected
40
+ def get_with_endpoint(url, args={}, params={})
41
+ params.merge! service_now_endpoint: @service_now_endpoint
42
+ get url, args, params
43
+ end
44
+
45
+ def post_with_endpoint(url, args={}, params={})
46
+ params.merge! service_now_endpoint: @service_now_endpoint
47
+ post url, args, params
48
+ end
29
49
  end
@@ -1,3 +1,3 @@
1
1
  module TicketAbstractorClient
2
- VERSION = '1.23.0'
2
+ VERSION = '1.24.0'
3
3
  end
@@ -11,7 +11,8 @@ module TicketAbstractorClient
11
11
  end
12
12
 
13
13
  def jira(endpoint = 'tp')
14
- @clients["jira_#{endpoint}".to_sym] ||= JiraClient.new(@url, @security_token, CGI.escape(endpoint.to_s))
14
+ client_key = "jira_#{endpoint}".to_sym
15
+ @clients[client_key] ||= JiraClient.new(@url, @security_token, CGI.escape(endpoint.to_s))
15
16
  end
16
17
 
17
18
  def brouha
@@ -30,8 +31,9 @@ module TicketAbstractorClient
30
31
  @clients[:sev_one] ||= SevOneClient.new(@url, @security_token)
31
32
  end
32
33
 
33
- def service_now
34
- @clients[:service_now] ||= ServiceNowClient.new(@url, @security_token)
34
+ def service_now(endpoint = 'default')
35
+ client_key = "service_now_#{endpoint}".to_sym
36
+ @clients[client_key] ||= ServiceNowClient.new(@url, @security_token, CGI.escape(endpoint))
35
37
  end
36
38
  end
37
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticket_abstractor_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.0
4
+ version: 1.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rsamoilov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2016-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler