ats 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 0dfb842c58ba12daf348cd93475e337e3d7cff331e99323cb68d9165de58bd36
4
- data.tar.gz: d249c457fb6093519613b98f0372da2bbe02fd0eeba450be64945bc2077c481b
3
+ metadata.gz: e51112c9321e6ed3927f822a200b2ec5482722f62d9b6373f4d5b12cc721a7cc
4
+ data.tar.gz: 0d78ebb5acd77375994b7c9d96fdb2ade67fb0d97c5c550fb643b879c1731e14
5
5
  SHA512:
6
- metadata.gz: 10ba44b6ec775c048742584ebfce45481d6199d0f10e534037d9ea230509fd8d5d6e05c003a6b514bde15f41f1f5ee90a6b90dc9c76d280a980cf8a353ae6b64
7
- data.tar.gz: 182cca226c7632d9f960f4bfb522b53da5d86e63e511b603be9f36ec13e171ae420dcdbe6c0156109baf8a9124a1ea35697fd9d84163070b9a746e5f680fcfb5
6
+ metadata.gz: bf31c66e5c7cb1f0b7a57923b4fd9d4e3b8ed1b69dd83f52361b65a1f9f0801fd9cf1362124741268f116512f8c4af635bd275ab99dabc0bcd180fca29694b56
7
+ data.tar.gz: 5e792ed8b04e0b5172fd16e14b413a8ea85ae3fc9ccf8308b94ba4a80a634eba51f380ab53d3f1181eafb2269aa83eb1758c552a3e03bac2d2987bc097f11374
@@ -44,19 +44,27 @@ module ATS
44
44
  private
45
45
 
46
46
  def build_uri(relative_url, version:)
47
- URI.parse("#{api_host}/v#{version}/#{relative_url}")
47
+ URI::Generic.build(host: host, port: port, scheme: scheme, path: "/v#{version}/#{relative_url}")
48
48
  end
49
49
 
50
50
  def client_id
51
- configuration[profile]['amp4e']['client_id']
51
+ configuration[profile][:amp4e][:client_id]
52
52
  end
53
53
 
54
54
  def client_secret
55
- configuration[profile]['amp4e']['client_secret']
55
+ configuration[profile][:amp4e][:client_secret]
56
56
  end
57
57
 
58
- def api_host
59
- configuration[profile]['amp4e']['api_host']
58
+ def host
59
+ configuration[profile][:amp4e][:host]
60
+ end
61
+
62
+ def scheme
63
+ configuration[profile][:amp4e][:scheme]
64
+ end
65
+
66
+ def port
67
+ configuration[profile][:amp4e][:port]
60
68
  end
61
69
 
62
70
  def headers
@@ -43,13 +43,17 @@ module ATS
43
43
  yaml = YAML.dump({
44
44
  default: {
45
45
  amp4e: {
46
- api_host: 'https://api.amp.cisco.com',
47
46
  client_id: '',
48
47
  client_secret: '',
48
+ host: 'api.amp.cisco.com',
49
+ port: 443,
50
+ scheme: 'https',
49
51
  },
50
52
  threat_grid: {
51
- api_host: 'https://example.com',
52
- api_key: 'secret'
53
+ api_key: '',
54
+ host: 'panacea.threatgrid.com',
55
+ port: 443,
56
+ scheme: 'https',
53
57
  },
54
58
  }
55
59
  })
@@ -15,7 +15,7 @@ module ATS
15
15
  end
16
16
 
17
17
  def [](key)
18
- @configuration[key]
18
+ @configuration[key.to_sym]
19
19
  end
20
20
 
21
21
  def load_configuration(files = config_files)
@@ -43,7 +43,7 @@ module ATS
43
43
  def http_for(uri)
44
44
  http = Net::HTTP.new(uri.host, uri.port)
45
45
  http.read_timeout = 30
46
- http.use_ssl = uri.is_a?(URI::HTTPS)
46
+ http.use_ssl = uri.scheme == "https"
47
47
  http.set_debug_output(ATS.logger)
48
48
  http
49
49
  end
@@ -16,7 +16,7 @@ module ATS
16
16
  configuration: ATS.configuration
17
17
  )
18
18
  @http = api
19
- @profile = profile.to_s
19
+ @profile = profile.to_sym
20
20
  @configuration = configuration
21
21
  end
22
22
 
@@ -53,15 +53,23 @@ module ATS
53
53
  end
54
54
 
55
55
  def build_uri(relative_url, version:)
56
- URI.parse("#{api_host}/api/v#{version}/#{relative_url}")
56
+ URI::Generic.build(host: host, port: port, scheme: scheme, path: "/api/v#{version}/#{relative_url}")
57
57
  end
58
58
 
59
59
  def api_key
60
- configuration[profile]['threat_grid']['api_key']
60
+ configuration[profile][:threat_grid][:api_key]
61
61
  end
62
62
 
63
- def api_host
64
- configuration[profile]['threat_grid']['api_host']
63
+ def host
64
+ configuration[profile][:threat_grid][:host]
65
+ end
66
+
67
+ def scheme
68
+ configuration[profile][:threat_grid][:scheme]
69
+ end
70
+
71
+ def port
72
+ configuration[profile][:threat_grid][:port]
65
73
  end
66
74
  end
67
75
  end
@@ -1,3 +1,3 @@
1
1
  module ATS
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mokha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-18 00:00:00.000000000 Z
11
+ date: 2018-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor