webspicy 0.1.0.pre.rc2 → 0.1.0.pre.rc3

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: 7a28abcbd9370b92059bc774da7c193e74e21ff5
4
- data.tar.gz: 978a67cffd6ed250e2665100b46b0404d0665179
3
+ metadata.gz: b6894d4163e21f8309c91e1befcf39ce59423e04
4
+ data.tar.gz: 61bc6deca7423852bea6daa1d5c2aacf7ec17c57
5
5
  SHA512:
6
- metadata.gz: 9987659b6d59e553c9bf9d46f8a37702b63d86929834d40c7570377fffbebba340b9fc0c6a72d5db3cc04e1905c451539ca20b2b29d2e866ae3e7c06f7e0dcdb
7
- data.tar.gz: 215a46e4ac9a2096673d39fd18e249c7e239e1452d4c67d032f50ff23f85e7bedf006d03667b263370ca1377d044755fd1f665737600f777deb4766986407798
6
+ metadata.gz: c403e240151fd262ee1982e0dbc4d839bdfcbf33e6682f5c0384fbd034b900de76871d3b6360284ee7ee29a4ad4281f57a329bb67ee053fe9e88c364d5dfbe59
7
+ data.tar.gz: 815d5fed96020fc8cc1db42443f1eaee72357793408c05f304801a34f4b5cdd7d8e0dca5883602c92eda0c94aaee11d671e6cbc33092d6871a88072b4d5e12d7
@@ -2,4 +2,6 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "rake", "~> 10"
4
4
  gem 'sinatra', "~> 2.0"
5
+ gem "path", "~> 1.3"
6
+ gem "finitio", "~> 0.5.2"
5
7
  gem "webspicy", path: "../.."
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- webspicy (0.0.1)
4
+ webspicy (0.1.0.pre.rc2)
5
5
  finitio (~> 0.5.2)
6
6
  http (~> 0.5)
7
7
  path (~> 1.3)
@@ -61,6 +61,8 @@ PLATFORMS
61
61
  ruby
62
62
 
63
63
  DEPENDENCIES
64
+ finitio (~> 0.5.2)
65
+ path (~> 1.3)
64
66
  rake (~> 10)
65
67
  sinatra (~> 2.0)
66
68
  webspicy!
@@ -1,5 +1,9 @@
1
1
  require 'sinatra'
2
2
  require 'json'
3
+ require 'path'
4
+ require 'finitio'
5
+
6
+ SCHEMA = Finitio::DEFAULT_SYSTEM.parse (Path.dir/'webspicy/schema.fio').read
3
7
 
4
8
  TODOLIST = [
5
9
  {
@@ -20,6 +24,19 @@ get '/todo/' do
20
24
  TODOLIST.to_json
21
25
  end
22
26
 
27
+ post '/todo/' do
28
+ content_type :json
29
+ todo = SCHEMA["Todo"].dress(JSON.load(request.body.read))
30
+ if TODOLIST.find{|t| t[:id] == todo[:id] }
31
+ status 409
32
+ {error: "Identifier already in use"}.to_json
33
+ else
34
+ TODOLIST << todo
35
+ status 201
36
+ todo.to_json
37
+ end
38
+ end
39
+
23
40
  get '/todo/:id' do |id|
24
41
  content_type :json
25
42
  todo = TODOLIST.find{|todo| todo[:id] == Integer(id) }
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: |-
3
+ Todo
4
+
5
+ url: |-
6
+ /todo/
7
+
8
+ services:
9
+ - method: |-
10
+ POST
11
+
12
+ description: |-
13
+ Creates a new todo item
14
+
15
+ preconditions: |-
16
+
17
+ input_schema: |-
18
+ Todo
19
+
20
+ output_schema: |-
21
+ Todo
22
+
23
+ error_schema: |-
24
+ {
25
+ error: String
26
+ }
27
+
28
+ examples:
29
+
30
+ - description: |-
31
+ when requested with a non existing ID
32
+ params:
33
+ id: 3
34
+ description: "Hello World"
35
+ expected:
36
+ content_type: application/json
37
+ status: 201
38
+ assert:
39
+ - "pathFD('', id: 3)"
40
+
41
+ counterexamples:
42
+
43
+ - description: |-
44
+ when requested while the id already exists
45
+ params:
46
+ id: 1
47
+ description: "Hello World"
48
+ expected:
49
+ content_type: application/json
50
+ status: 409
51
+ assert:
52
+ - "pathFD('', error: 'Identifier already in use')"
@@ -17,10 +17,11 @@ module Webspicy
17
17
 
18
18
  before(:all) do
19
19
  client.before(test_case, service, resource)
20
+ @invocation ||= client.call(test_case, service, resource)
20
21
  end
21
22
 
22
23
  subject do
23
- @invocation ||= client.call(test_case, service, resource)
24
+ @invocation
24
25
  end
25
26
 
26
27
  it 'can be invoked successfuly' do
@@ -52,10 +53,11 @@ module Webspicy
52
53
 
53
54
  before(:all) do
54
55
  client.before(test_case, service, resource)
56
+ @invocation ||= client.call(test_case, service, resource)
55
57
  end
56
58
 
57
59
  subject do
58
- @invocation ||= client.call(test_case, service, resource)
60
+ @invocation
59
61
  end
60
62
 
61
63
  it 'can be invoked successfuly' do
@@ -1,6 +1,6 @@
1
1
  module Webspicy
2
2
  module Version
3
- TINY = "0-rc2"
3
+ TINY = "0-rc3"
4
4
  MINOR = 1
5
5
  MAJOR = 0
6
6
  end
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.1.0.pre.rc2
4
+ version: 0.1.0.pre.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
@@ -97,6 +97,7 @@ files:
97
97
  - examples/restful/webspicy/schema.fio
98
98
  - examples/restful/webspicy/todo/getTodo.yml
99
99
  - examples/restful/webspicy/todo/getTodos.yml
100
+ - examples/restful/webspicy/todo/postTodos.yml
100
101
  - lib/webspicy.rb
101
102
  - lib/webspicy/checker.rb
102
103
  - lib/webspicy/client.rb