api_sim 1.2.0 → 1.2.1

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: 68730144a320ff78fd1a860b3b2f2f1adc36b662
4
- data.tar.gz: 2e5cf3747afbb3995bf96d60a3662ff294239c11
3
+ metadata.gz: f99417ce6d0d07679847a4fb57b773fc12bbd5fb
4
+ data.tar.gz: f60a112212248f77d3f8008ae46ad729d50b7d67
5
5
  SHA512:
6
- metadata.gz: 24e685f735efbf7fb56c9d1b81375ba464ee8e5ba0eca75b92f918c6af1fc4453a4d8599e1f6796dd0631c05568096b47bb52ece8f9df0794484c4130b16f92a
7
- data.tar.gz: 08c7bb5aca6d50e4ae6fed9b806225cfa81f52ae495c13faff02d89efed2cd5a82b74480dd10b560deb23e00c562f7bd96728570993b5d2b649bc3726640aa4e
6
+ metadata.gz: 6500c40ebe3656365a91d316f587331da42b33a1b9a76aae4aaf026e6279be56a762013a8d3919440c927a14f24b6713bf525cb6cd16261e693c1cd3c6d01f94
7
+ data.tar.gz: f6654077caf4b6493722a355d5fb228ef012a03e03243bbcddf49c19f9acfd119be52a5ca11713d42db6f1ad1ce86f9f1eaa332a699d62a5db607f60d900752d
@@ -1,3 +1,3 @@
1
1
  module ApiSim
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -37,5 +37,13 @@ module ApiSim
37
37
  </a>
38
38
  HTML
39
39
  end
40
+
41
+ def endpoint_match (endpoint)
42
+ if endpoint.match_on_body? then
43
+ "/#{endpoint.matcher.source}/"
44
+ else
45
+ ''
46
+ end
47
+ end
40
48
  end
41
49
  end
@@ -1,4 +1,3 @@
1
- <% require_relative '../helpers/view_helpers' %>
2
1
  <h2>Simulators</h2>
3
2
  <table>
4
3
  <thead>
@@ -14,7 +13,7 @@
14
13
  <% endpoints.each do |endpoint| %>
15
14
  <tr>
16
15
  <td><%= endpoint.http_method %> <%= endpoint.route %> <%= custom_matcher?(endpoint) %></td>
17
- <td><%= ViewHelpers.endpoint_match endpoint %></td>
16
+ <td><%= endpoint_match endpoint %></td>
18
17
  <td>
19
18
  <% if endpoint.readonly? %>
20
19
  Cannot edit dynamic endpoints
@@ -28,7 +27,7 @@
28
27
  <td>
29
28
  <form action="/ui/response/<%= endpoint.http_method %><%= endpoint.route %>" method="post">
30
29
  <input type="hidden" value="delete" name="_method">
31
- <input type="hidden" value="<%= ViewHelpers.endpoint_match endpoint %>" name="match">
30
+ <input type="hidden" value="<%= endpoint_match endpoint %>" name="match">
32
31
  <button class='btn-link' type="submit">Reset</button>
33
32
  </form>
34
33
  </td>
@@ -25,21 +25,21 @@
25
25
  <% if config.match_on_body? %>
26
26
  <div class="form-group">
27
27
  <label for="match">Match body on</label>
28
- <input type="text" class="form-control" id="match" name="match" disabled="disabled" value="<%= params[:match] || config.matcher.source %>"/>
28
+ <input type="text" class="form-control" id="match" name="match" disabled="disabled" value="<%= h (params[:match] || config.matcher.source) %>"/>
29
29
  <input type="hidden" id="match" name="match" value="<%= params[:match] || config.matcher.source %>"/>
30
30
  </div>
31
31
  <% end %>
32
32
 
33
33
  <div class="form-group">
34
34
  <label for="schema">Response schema</label>
35
- <textarea type="text" class="form-control" id="schema" name="schema" data-prettify rows="25"><%= params['schema'] || config.schema %></textarea>
35
+ <textarea type="text" class="form-control" id="schema" name="schema" data-prettify rows="25"><%= h (params['schema'] || config.schema) %></textarea>
36
36
  </div>
37
37
  </div>
38
38
 
39
39
  <div class="col-md-6">
40
40
  <div class="form-group">
41
41
  <label for="body">Response body</label>
42
- <textarea class="form-control" id="body" name="body" data-prettify rows="25"><%= params['body'] || config.response_body %></textarea>
42
+ <textarea class="form-control" id="body" name="body" data-prettify rows="25"><%= h (params['body'] || config.response_body) %></textarea>
43
43
  </div>
44
44
  </div>
45
45
 
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: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -130,7 +130,6 @@ files:
130
130
  - lib/api_sim.rb
131
131
  - lib/api_sim/app_builder.rb
132
132
  - lib/api_sim/built_app.rb
133
- - lib/api_sim/helpers/view_helpers.rb
134
133
  - lib/api_sim/matchers.rb
135
134
  - lib/api_sim/matchers/base_matcher.rb
136
135
  - lib/api_sim/matchers/dynamic_request_matcher.rb
@@ -1,12 +0,0 @@
1
- module ViewHelpers
2
-
3
- def self.endpoint_match (endpoint)
4
- if endpoint.match_on_body? then
5
- "/#{endpoint.matcher.source}/"
6
- else
7
- ''
8
- end
9
- end
10
-
11
- end
12
-