api_sim 7.0.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/README.md +50 -0
- data/api_sim.gemspec +2 -2
- data/examples/basic/Gemfile.lock +13 -13
- data/examples/cors/Gemfile.lock +21 -18
- data/examples/with-fixtures/Gemfile.lock +19 -17
- data/lib/api_sim/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 327685bacf8a6f9deecaa212e828fb2357c733f56ff84b34e55d883014c54d01
|
4
|
+
data.tar.gz: bf1feab48cb25aadbbca0f5a6602c1ed47c4781b40833033857f1c0a40dfac62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdd5e1c789269cd0bd2e87e5a9616987f4ff726406e43f9070e668120e2fc548de0dd5d5434c77273bb55cb850b7e357976b27cdc12f2c51c00277af698782b5
|
7
|
+
data.tar.gz: 887ab0200e2597021038c29f2f518b0f8c3d48f68160c54cecd738325ee59fd137ab758f6b05d3ed3f4d52fff241f656fdd3c22cad21f31ca5fbc51633b004a0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -54,12 +54,62 @@ After which the simulators should be running on port 9292.
|
|
54
54
|
|
55
55
|
## API
|
56
56
|
|
57
|
+
API Sim has an HTTP API that allows you, the developer, to manage responses and verify
|
58
|
+
requests.
|
59
|
+
|
60
|
+
### The "Request/Response" API
|
61
|
+
|
62
|
+
|
63
|
+
#### Modify the response from an endpoint
|
64
|
+
|
65
|
+
The star in the path should match the request path that you want to update.
|
66
|
+
The "method" in the PUT request should match the HTTP method for the request.
|
67
|
+
```HTTP
|
68
|
+
HTTP/1.1 PUT /response/*
|
69
|
+
{
|
70
|
+
"method": "post",
|
71
|
+
"status": 999,
|
72
|
+
"body": "{\"id\": 99}",
|
73
|
+
"headers": {"NEW-HEADER": "output"}
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
#### Read requests made to an endpoint
|
80
|
+
|
81
|
+
The star in the path should match the path that you want to retrieve requests for.
|
82
|
+
```HTTP
|
83
|
+
GET /requests/:method/*
|
84
|
+
```
|
85
|
+
|
86
|
+
```HTTP
|
87
|
+
HTTP/1.1 200 OK
|
88
|
+
|
89
|
+
[
|
90
|
+
{}
|
91
|
+
]
|
92
|
+
```
|
93
|
+
|
94
|
+
### 498
|
95
|
+
|
57
96
|
The API that these simulators generate can get pretty smart. To help you, the user,
|
58
97
|
distinguish between failures and "smarts", we've made up an HTTP status code: 498.
|
59
98
|
This code means "we received a request that did not match an expected schema". If you
|
60
99
|
provide the simulators with a request schema for an endpoint, all requests must match
|
61
100
|
that schema. If they do not, they'll receive our fictional status code.
|
62
101
|
|
102
|
+
## UI
|
103
|
+
|
104
|
+
The simulator application has a UI for manipulating and monitoring requests and responses.
|
105
|
+
You can view this UI by visiting `/ui` at the URL of the simulator.
|
106
|
+
|
107
|
+
Additionally, you can configure the endpoint for viewing the UI by adding to your config.ru.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
ui_root '/path/to/ui'
|
111
|
+
```
|
112
|
+
|
63
113
|
## Development
|
64
114
|
|
65
115
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/api_sim.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "sinatra", '~>
|
22
|
+
spec.add_dependency "sinatra", '~> 2.0'
|
23
23
|
spec.add_dependency "nokogiri", '~> 1.6'
|
24
24
|
spec.add_dependency "json-schema", '>= 2.5'
|
25
25
|
spec.add_dependency "mustermann", '~> 1.0.0.beta2'
|
26
|
-
spec.add_development_dependency "bundler", "~> 1
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_development_dependency "capybara", "~> 2.7"
|
data/examples/basic/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
api_sim (
|
4
|
+
api_sim (7.0.0)
|
5
5
|
json-schema (>= 2.5)
|
6
6
|
mustermann (~> 1.0.0.beta2)
|
7
7
|
nokogiri (~> 1.6)
|
@@ -10,23 +10,23 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
addressable (2.
|
14
|
-
public_suffix (>= 2.0.2, <
|
15
|
-
json-schema (2.8.
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
json-schema (2.8.1)
|
16
16
|
addressable (>= 2.4)
|
17
|
-
mini_portile2 (2.
|
18
|
-
mustermann (1.0.
|
19
|
-
nokogiri (1.
|
20
|
-
mini_portile2 (~> 2.
|
21
|
-
public_suffix (
|
22
|
-
rack (1.6.
|
23
|
-
rack-protection (1.5.
|
17
|
+
mini_portile2 (2.4.0)
|
18
|
+
mustermann (1.0.3)
|
19
|
+
nokogiri (1.10.7)
|
20
|
+
mini_portile2 (~> 2.4.0)
|
21
|
+
public_suffix (4.0.1)
|
22
|
+
rack (1.6.11)
|
23
|
+
rack-protection (1.5.5)
|
24
24
|
rack
|
25
25
|
sinatra (1.4.8)
|
26
26
|
rack (~> 1.5)
|
27
27
|
rack-protection (~> 1.4)
|
28
28
|
tilt (>= 1.3, < 3)
|
29
|
-
tilt (2.0.
|
29
|
+
tilt (2.0.10)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
ruby
|
@@ -35,4 +35,4 @@ DEPENDENCIES
|
|
35
35
|
api_sim!
|
36
36
|
|
37
37
|
BUNDLED WITH
|
38
|
-
1.
|
38
|
+
1.17.2
|
data/examples/cors/Gemfile.lock
CHANGED
@@ -1,31 +1,34 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ../..
|
3
3
|
specs:
|
4
|
-
api_sim (
|
4
|
+
api_sim (7.0.0)
|
5
5
|
json-schema (>= 2.5)
|
6
|
-
|
7
|
-
|
6
|
+
mustermann (~> 1.0.0.beta2)
|
7
|
+
nokogiri (~> 1.6)
|
8
|
+
sinatra (~> 1.4)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rack
|
22
|
-
rack-
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
json-schema (2.8.1)
|
16
|
+
addressable (>= 2.4)
|
17
|
+
mini_portile2 (2.4.0)
|
18
|
+
mustermann (1.0.3)
|
19
|
+
nokogiri (1.10.7)
|
20
|
+
mini_portile2 (~> 2.4.0)
|
21
|
+
public_suffix (4.0.1)
|
22
|
+
rack (1.6.11)
|
23
|
+
rack-cors (1.0.6)
|
24
|
+
rack (>= 1.6.0)
|
25
|
+
rack-protection (1.5.5)
|
23
26
|
rack
|
24
|
-
sinatra (1.4.
|
27
|
+
sinatra (1.4.8)
|
25
28
|
rack (~> 1.5)
|
26
29
|
rack-protection (~> 1.4)
|
27
30
|
tilt (>= 1.3, < 3)
|
28
|
-
tilt (2.0.
|
31
|
+
tilt (2.0.10)
|
29
32
|
|
30
33
|
PLATFORMS
|
31
34
|
ruby
|
@@ -35,4 +38,4 @@ DEPENDENCIES
|
|
35
38
|
rack-cors
|
36
39
|
|
37
40
|
BUNDLED WITH
|
38
|
-
1.
|
41
|
+
1.17.2
|
@@ -1,30 +1,32 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ../..
|
3
3
|
specs:
|
4
|
-
api_sim (
|
4
|
+
api_sim (7.0.0)
|
5
5
|
json-schema (>= 2.5)
|
6
|
-
|
7
|
-
|
6
|
+
mustermann (~> 1.0.0.beta2)
|
7
|
+
nokogiri (~> 1.6)
|
8
|
+
sinatra (~> 1.4)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rack
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
json-schema (2.8.1)
|
16
|
+
addressable (>= 2.4)
|
17
|
+
mini_portile2 (2.4.0)
|
18
|
+
mustermann (1.0.3)
|
19
|
+
nokogiri (1.10.7)
|
20
|
+
mini_portile2 (~> 2.4.0)
|
21
|
+
public_suffix (4.0.1)
|
22
|
+
rack (1.6.11)
|
23
|
+
rack-protection (1.5.5)
|
22
24
|
rack
|
23
|
-
sinatra (1.4.
|
25
|
+
sinatra (1.4.8)
|
24
26
|
rack (~> 1.5)
|
25
27
|
rack-protection (~> 1.4)
|
26
28
|
tilt (>= 1.3, < 3)
|
27
|
-
tilt (2.0.
|
29
|
+
tilt (2.0.10)
|
28
30
|
|
29
31
|
PLATFORMS
|
30
32
|
ruby
|
@@ -33,4 +35,4 @@ DEPENDENCIES
|
|
33
35
|
api_sim!
|
34
36
|
|
35
37
|
BUNDLED WITH
|
36
|
-
1.
|
38
|
+
1.17.2
|
data/lib/api_sim/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_sim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TJ Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1
|
75
|
+
version: '2.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1
|
82
|
+
version: '2.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,8 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
|
193
|
-
rubygems_version: 2.6.11
|
192
|
+
rubygems_version: 3.1.2
|
194
193
|
signing_key:
|
195
194
|
specification_version: 4
|
196
195
|
summary: A DSL on top of sinatra for building application simulators
|