webspicy 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/restful/Gemfile.lock +12 -12
- data/examples/restful/app.rb +5 -1
- data/examples/restful/webspicy/todo/options.yml +34 -0
- data/lib/webspicy.rb +2 -2
- data/lib/webspicy/client/http_client.rb +11 -0
- data/lib/webspicy/client/rack_test_client.rb +14 -0
- data/lib/webspicy/formaldoc.fio +1 -1
- data/lib/webspicy/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 307186390914fac502fb560054045ff9936bfd84
|
4
|
+
data.tar.gz: 8d8e2493375de6c5273fb19d57819581665e2ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c902c091f409e70587947564b458e0d0090275c6d908b4bc57440a15c0c7c382a6bb8996a31302f23ca1c0504f4c28de44792d07c80bd76c8509f07230cac13
|
7
|
+
data.tar.gz: b0d2bef54001b8d1c6ef8218265b8567309c71cd88302ac09193a714e50e9a9d4e1e04b2e52ddb634b87e8d0035745eb715a4b4f4249a229bf2f199b6c5c52ae
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
webspicy (0.8.
|
4
|
+
webspicy (0.8.2)
|
5
5
|
finitio (~> 0.5.2)
|
6
6
|
http (~> 2)
|
7
7
|
path (~> 1.3)
|
@@ -39,19 +39,19 @@ GEM
|
|
39
39
|
rack-test (0.6.3)
|
40
40
|
rack (>= 1.0)
|
41
41
|
rake (10.5.0)
|
42
|
-
rspec (3.
|
43
|
-
rspec-core (~> 3.
|
44
|
-
rspec-expectations (~> 3.
|
45
|
-
rspec-mocks (~> 3.
|
46
|
-
rspec-core (3.
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-expectations (3.
|
42
|
+
rspec (3.7.0)
|
43
|
+
rspec-core (~> 3.7.0)
|
44
|
+
rspec-expectations (~> 3.7.0)
|
45
|
+
rspec-mocks (~> 3.7.0)
|
46
|
+
rspec-core (3.7.0)
|
47
|
+
rspec-support (~> 3.7.0)
|
48
|
+
rspec-expectations (3.7.0)
|
49
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
50
|
+
rspec-support (~> 3.7.0)
|
51
|
+
rspec-mocks (3.7.0)
|
52
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
53
|
+
rspec-support (~> 3.7.0)
|
54
|
+
rspec-support (3.7.0)
|
55
55
|
sinatra (2.0.0)
|
56
56
|
mustermann (~> 1.0)
|
57
57
|
rack (~> 2.0)
|
data/examples/restful/app.rb
CHANGED
@@ -5,7 +5,7 @@ require 'finitio'
|
|
5
5
|
require 'rack/robustness'
|
6
6
|
require 'csv'
|
7
7
|
|
8
|
-
SCHEMA = Finitio::DEFAULT_SYSTEM.parse (Path.dir/'webspicy/schema.fio').read
|
8
|
+
SCHEMA = Finitio::DEFAULT_SYSTEM.parse (Path.dir/('webspicy/schema.fio')).read
|
9
9
|
|
10
10
|
TODOLIST = [
|
11
11
|
{
|
@@ -31,6 +31,10 @@ use Rack::Robustness do |g|
|
|
31
31
|
g.on(Finitio::TypeError)
|
32
32
|
end
|
33
33
|
|
34
|
+
options '*' do
|
35
|
+
status 204
|
36
|
+
""
|
37
|
+
end
|
34
38
|
|
35
39
|
post '/reset' do
|
36
40
|
settings.todolist = TODOLIST.dup
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
name: |-
|
3
|
+
Todo
|
4
|
+
|
5
|
+
url: |-
|
6
|
+
/todo/
|
7
|
+
|
8
|
+
services:
|
9
|
+
- method: |-
|
10
|
+
OPTIONS
|
11
|
+
|
12
|
+
description: |-
|
13
|
+
Returns options about the web service
|
14
|
+
|
15
|
+
preconditions: |-
|
16
|
+
|
17
|
+
input_schema: |-
|
18
|
+
{
|
19
|
+
}
|
20
|
+
|
21
|
+
output_schema: |-
|
22
|
+
.
|
23
|
+
|
24
|
+
error_schema: |-
|
25
|
+
ErrorSchema
|
26
|
+
|
27
|
+
examples:
|
28
|
+
|
29
|
+
- description: |-
|
30
|
+
when requested on an existing TODO
|
31
|
+
params: {}
|
32
|
+
expected:
|
33
|
+
content_type: ~
|
34
|
+
status: 204
|
data/lib/webspicy.rb
CHANGED
@@ -30,13 +30,13 @@ module Webspicy
|
|
30
30
|
|
31
31
|
ROOT_FOLDER = Path.backfind('.[Gemfile]')
|
32
32
|
|
33
|
-
EXAMPLES_FOLDER = ROOT_FOLDER/'examples'
|
33
|
+
EXAMPLES_FOLDER = ROOT_FOLDER/('examples')
|
34
34
|
|
35
35
|
###
|
36
36
|
### About formal doc and resources defined there
|
37
37
|
###
|
38
38
|
|
39
|
-
FORMALDOC = Finitio::DEFAULT_SYSTEM.parse (Path.dir/"webspicy/formaldoc.fio").read
|
39
|
+
FORMALDOC = Finitio::DEFAULT_SYSTEM.parse (Path.dir/("webspicy/formaldoc.fio")).read
|
40
40
|
|
41
41
|
# Returns a default scope instance.
|
42
42
|
def default_scope
|
@@ -31,6 +31,17 @@ module Webspicy
|
|
31
31
|
|
32
32
|
attr_reader :last_response
|
33
33
|
|
34
|
+
def options(url, params = {}, headers = nil, body = nil)
|
35
|
+
Webspicy.info("OPTIONS #{url} -- #{params.inspect}")
|
36
|
+
|
37
|
+
@last_response = HTTP[headers || {}].options(url, params: params)
|
38
|
+
|
39
|
+
Webspicy.debug("Headers: #{@last_response.headers.to_hash}")
|
40
|
+
Webspicy.debug("Response: #{@last_response.body}")
|
41
|
+
|
42
|
+
@last_response
|
43
|
+
end
|
44
|
+
|
34
45
|
def get(url, params = {}, headers = nil, body = nil)
|
35
46
|
Webspicy.info("GET #{url} -- #{params.inspect}")
|
36
47
|
|
@@ -61,6 +61,20 @@ module Webspicy
|
|
61
61
|
@app = app
|
62
62
|
end
|
63
63
|
|
64
|
+
def options(url, params = {}, headers = nil, body = nil)
|
65
|
+
handler = get_handler(headers)
|
66
|
+
|
67
|
+
Webspicy.info("OPTIONS #{url} -- #{params.inspect} -- #{headers.inspect}")
|
68
|
+
|
69
|
+
handler.options(url, params)
|
70
|
+
@last_response = handler.last_response
|
71
|
+
|
72
|
+
Webspicy.debug("Headers: #{@last_response.headers.to_hash}")
|
73
|
+
Webspicy.debug("Response: #{@last_response.body}")
|
74
|
+
|
75
|
+
@last_response
|
76
|
+
end
|
77
|
+
|
64
78
|
def get(url, params = {}, headers = nil, body = nil)
|
65
79
|
handler = get_handler(headers)
|
66
80
|
|
data/lib/webspicy/formaldoc.fio
CHANGED
data/lib/webspicy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webspicy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- examples/restful/webspicy/todo/deleteTodo.yml
|
144
144
|
- examples/restful/webspicy/todo/getTodo.yml
|
145
145
|
- examples/restful/webspicy/todo/getTodos.yml
|
146
|
+
- examples/restful/webspicy/todo/options.yml
|
146
147
|
- examples/restful/webspicy/todo/patchTodo.yml
|
147
148
|
- examples/restful/webspicy/todo/postCsv.yml
|
148
149
|
- examples/restful/webspicy/todo/postTodos.yml
|