swagger_coverage 0.0.6 → 0.0.7

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: f613780fa11b8056da41a388bf857bd52d2e038c
4
- data.tar.gz: 3adf5b54efdfbe3a7c9468f377dabafe38846630
3
+ metadata.gz: 67bef6ff8116e268817e48dade898724adc22289
4
+ data.tar.gz: 0558284249fe3fa76526a6874b5bcbfb412ef254
5
5
  SHA512:
6
- metadata.gz: ee1228d7de4d959277dd517c627b2619205238c38ed65140e9e0ec4d819028bc6b446d49aa798a436972d4e4c780ee8926d63db63fcfb8c5efa967e6a404572d
7
- data.tar.gz: 2566daa222437eb37aed1455e71c21fe12d5ebac01050b1e0709c572af44e763ccf17daec5a71cfedddfcedf25eee3431ac1961c6218a87a4a855c37726c0b42
6
+ metadata.gz: eeedf4aceb395ae609d99d227df487b6953ea84d59f6bd8a0c28ab4ecc404b9cebef8bea37cd160806a59e37b8f29112255cb0fdb28a35a03787c276dd034f10
7
+ data.tar.gz: 3dc5494fdad9d19f812102477160b24c348d6defcda0357391d1c0b3118a94e8e9862f950c64dda81827b38aea8cc0a19c9e4109bba31b5c69d24a91de8df284
@@ -1,3 +1,3 @@
1
1
  module SwaggerCoverage
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -13,6 +13,9 @@ class SwaggerParser
13
13
  def api_endpoints
14
14
  endpoints = []
15
15
  base_path = @parse['basePath']
16
+ if base_path == nil
17
+ raise "'basePath' not specified in swagger documentation"
18
+ end
16
19
  swag_path = ''
17
20
  @parse['paths'].each do |path|
18
21
  swag_path = base_path + path.first.gsub('{', ':').gsub('}', '')
@@ -24,8 +27,16 @@ class SwaggerParser
24
27
  def http_requests
25
28
  request_types_arr = []
26
29
  paths_arr = []
30
+ base_path = @parse['basePath']
31
+ if base_path == nil
32
+ raise "'basePath' not specified in swagger documentation"
33
+ end
27
34
  @parse['paths'].each do |path|
28
- paths_arr << path.first if path.first.include?('api')
35
+ if base_path.include?('api')
36
+ paths_arr << path.first
37
+ else
38
+ paths_arr << path.first if path.first.include?('api')
39
+ end
29
40
  end
30
41
  paths_arr.each do |path|
31
42
  @yaml_file ? req = @parse['paths'] : req = @parse['paths'][path]
data/routes3.txt ADDED
@@ -0,0 +1,3 @@
1
+ health_path GET /health PortScan.HealthController :index
2
+ v1_api_path GET /api/v1 PortScan.ApiController :index
3
+ v1_scan_path GET /api/v1/port-scan PortScan.ScanController :index
data/swagger.json CHANGED
@@ -1 +1,206 @@
1
- {"swagger":"2.0","schemes":["http"],"produces":["application/json"],"paths":{"/api/v1/lookup/{id}":{"get":{"responses":{"500":{"description":"Internal Server Error"},"404":{"description":"Resource not found"},"401":{"description":"Request is not authorized"},"200":{"description":"Resource Content"}},"produces":["application/json"],"parameters":[{"type":"integer","required":true,"name":"id","in":"path","description":""}],"operationId":"show","description":""}},"/api/v1":{"get":{"responses":{"500":{"description":"Internal Server Error"},"404":{"description":"Resource not found"},"401":{"description":"Request is not authorized"},"200":{"description":"Resource Content"}},"produces":["application/json"],"parameters":[],"operationId":"index","description":""}},"/api":{"get":{"responses":{"500":{"description":"Internal Server Error"},"404":{"description":"Resource not found"},"401":{"description":"Request is not authorized"},"200":{"description":"Resource Content"}},"produces":["application/json"],"parameters":[],"operationId":"index","description":""}}},"info":{"version":"","title":"ip-check-backend","termsOfService":"","license":{"url":"","name":""},"description":"","contact":{"url":"","name":"Jason Hatchett","email":"jasonh@spiceworks.com"}},"host":"api.spiceworks.com","definitions":{"Ecto.Migration.SchemaMigration":{"properties":{"version":{"type":"integer","format":"int64"},"inserted_at":{"type":"string","format":"date-time"}}}},"consumes":["application/json"],"basePath":""}
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "IP Lookup API",
5
+ "description": "Query an IP or Domain to get details about location and organization",
6
+ "version": "1.0.0"
7
+ },
8
+ "host": "api.spiceworks.com",
9
+ "schemes": [
10
+ "https"
11
+ ],
12
+ "basePath": "",
13
+ "produces": [
14
+ "application/json"
15
+ ],
16
+ "paths": {
17
+ "/api": {
18
+ "get": {
19
+ "responses": {
20
+ "200": {
21
+ "description": "OK",
22
+ "schema": {
23
+ "$ref": "#/definitions/API_info"
24
+ }
25
+ }
26
+ }
27
+ }
28
+ },
29
+ "/api/v1": {
30
+ "get": {
31
+ "summary": "API v1 Information",
32
+ "tags": [
33
+ "API"
34
+ ],
35
+ "responses": {
36
+ "200": {
37
+ "description": "OK",
38
+ "schema": {
39
+ "$ref": "#/definitions/v1_info"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "/api/v1/lookup/{id}": {
46
+ "get": {
47
+ "summary": "Location Information",
48
+ "description": "This endpoint returns information about a the location of the server at the queried domain or IP address.",
49
+ "parameters": [
50
+ {
51
+ "name": "id",
52
+ "in": "path",
53
+ "description": "IP Address or Domain Name",
54
+ "required": true,
55
+ "type": "string",
56
+ "format": "string"
57
+ }
58
+ ],
59
+ "tags": [
60
+ "IP Lookup"
61
+ ],
62
+ "responses": {
63
+ "200": {
64
+ "description": "Location Information",
65
+ "schema": {
66
+ "$ref": "#/definitions/Information"
67
+ }
68
+ },
69
+ "404": {
70
+ "description": "Errors",
71
+ "schema": {
72
+ "type": "array",
73
+ "items": {
74
+ "$ref": "#/definitions/Error"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "definitions": {
83
+ "Information": {
84
+ "type": "object",
85
+ "properties": {
86
+ "data": {
87
+ "type": "object",
88
+ "description": "container for payload",
89
+ "properties": {
90
+ "id": {
91
+ "type": "string",
92
+ "description": "address queried"
93
+ },
94
+ "type": {
95
+ "type": "string",
96
+ "description": "should always be host-info"
97
+ },
98
+ "attributes": {
99
+ "type": "object",
100
+ "description": "payload fields",
101
+ "properties": {
102
+ "organization": {
103
+ "type": "string",
104
+ "description": "the owner of the domain and ip-address"
105
+ },
106
+ "location": {
107
+ "type": "object",
108
+ "description": "container for all location data",
109
+ "properties": {
110
+ "city": {
111
+ "type": "string"
112
+ },
113
+ "country": {
114
+ "type": "string"
115
+ },
116
+ "region": {
117
+ "type": "string"
118
+ },
119
+ "latitude": {
120
+ "type": "number"
121
+ },
122
+ "longitude": {
123
+ "type": "number"
124
+ }
125
+ }
126
+ },
127
+ "ip-address": {
128
+ "type": "string"
129
+ },
130
+ "hostname": {
131
+ "type": "string"
132
+ },
133
+ "domain-name": {
134
+ "type": "string"
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ },
142
+ "v1_info": {
143
+ "type": "object",
144
+ "properties": {
145
+ "routes": {
146
+ "type": "object",
147
+ "properties": {
148
+ "lookup": {
149
+ "type": "object",
150
+ "properties": {
151
+ "params": {
152
+ "type": "object",
153
+ "properties": {
154
+ "id": {
155
+ "type": "string"
156
+ }
157
+ }
158
+ },
159
+ "actions": {
160
+ "type": "object",
161
+ "properties": {
162
+ "get": {
163
+ "type": "object",
164
+ "properties": {
165
+ "show": {
166
+ "type": "string"
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ },
178
+ "API_info": {
179
+ "type": "object",
180
+ "properties": {
181
+ "data": {
182
+ "type": "object",
183
+ "properties": {
184
+ "versions": {
185
+ "type": "object",
186
+ "properties": {
187
+ "v1": {
188
+ "type": "string"
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ },
196
+ "Error": {
197
+ "type": "object",
198
+ "properties": {
199
+ "detail": {
200
+ "type": "string",
201
+ "description": "Error message from server."
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
data/swagger3.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "Port Scan API",
5
+ "description": "Query an IP or Domain to get details about location and organization",
6
+ "version": "1.0.0"
7
+ },
8
+ "host": "api.spiceworks.com",
9
+ "schemes": [
10
+ "https"
11
+ ],
12
+ "basePath": "/api",
13
+ "produces": [
14
+ "application/json"
15
+ ],
16
+ "paths": {
17
+ "/v1": {
18
+ "get": {
19
+ "responses": {
20
+ "200": {
21
+ "description": "OK"
22
+ }
23
+ }
24
+ }
25
+ },
26
+ "/v1/port-scan": {
27
+ "get": {
28
+ "summary": "Port Information",
29
+ "description": "This endpoint returns information about a limited selection of public-facing ports at the designated host, revealing if they are open or closed.\n",
30
+ "parameters": [
31
+ {
32
+ "name": "address",
33
+ "in": "query",
34
+ "description": "IP Address or Domain Name",
35
+ "required": true,
36
+ "type": "string",
37
+ "format": "string"
38
+ },
39
+ {
40
+ "name": "port",
41
+ "in": "query",
42
+ "description": "Port Number",
43
+ "required": false,
44
+ "type": "integer",
45
+ "format": "integer"
46
+ }
47
+ ],
48
+ "tags": [
49
+ "Port-Scan"
50
+ ],
51
+ "responses": {
52
+ "200": {
53
+ "description": "Port Information",
54
+ "schema": {
55
+ "type": "array",
56
+ "items": {
57
+ "$ref": "#/definitions/Port"
58
+ }
59
+ }
60
+ },
61
+ "404": {
62
+ "description": "Errors",
63
+ "schema": {
64
+ "type": "array",
65
+ "items": {
66
+ "$ref": "#/definitions/Error"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "definitions": {
75
+ "Port": {
76
+ "type": "object",
77
+ "properties": {
78
+ "id": {
79
+ "type": "integer",
80
+ "description": "Unique identifier of the port listing, usually identical to the actual port"
81
+ },
82
+ "description": {
83
+ "type": "string",
84
+ "description": "Description of the port's most commonly hosted service"
85
+ },
86
+ "status": {
87
+ "type": "string",
88
+ "description": "This will describe if the port's status is either \"Open\" or \"Closed\""
89
+ },
90
+ "service": {
91
+ "type": "string",
92
+ "description": "The shorthand abbreviation of the service most commonly hosted on this port."
93
+ },
94
+ "port": {
95
+ "type": "string",
96
+ "description": "The number designated for the port."
97
+ }
98
+ }
99
+ },
100
+ "Error": {
101
+ "type": "object",
102
+ "properties": {
103
+ "detail": {
104
+ "type": "string",
105
+ "description": "Error message from server."
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Harthcock
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,9 @@ files:
52
52
  - non_api_routes_test_info/routes.txt
53
53
  - non_api_routes_test_info/swagger.json
54
54
  - routes.txt
55
+ - routes3.txt
55
56
  - swagger.json
57
+ - swagger3.json
56
58
  - swagger_coverage.gemspec
57
59
  homepage: https://gitlab.spice.spiceworks.com/spiceworks/swagger-cov.git
58
60
  licenses: