api_schema 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b2a8c57cfedd14fc423b49395fd225556142804
4
- data.tar.gz: e1f0a3c85c0979b5753047ca82614a7037df9df1
3
+ metadata.gz: ee3334a6b84fcdea073dd676ab06b21546851d4b
4
+ data.tar.gz: 1fb668c1353c45e69df045e5b2ad5c6e2ce3efec
5
5
  SHA512:
6
- metadata.gz: ef3a48ce41d582889c64fb6d5e7b766136c105aaece4ea8c4d9d6849a9970bca8a3e40084148c25e5d2ea7de243be7bf0920238c77d4c0135fa59ff81bd45953
7
- data.tar.gz: d17267333e18d5ba621f5a85926d41d7e3498b40ac0823c9aff3e4e41228409068362db4043526baadef497b0febd86ebe8e8071fad488505580c32778e31bc1
6
+ metadata.gz: d093ee56e095d80380455875dcf29bc0e6ba52a464274ad800ef78d4231e34e1b47262e5205d14826e300976214a0f354ea91f4c62cdd4bdb96edd5b722f7602
7
+ data.tar.gz: c69ec8ced324c26e66e3a9f19b0d6bc09a2a6f2e65438b2672b2a1106cf6c6040465e80c568631279fd304eac28f56d27401054795a866a8abf4efa35d3c75b5
@@ -15,11 +15,11 @@ module Swagger
15
15
  end
16
16
  end
17
17
 
18
- def header_param(name, type)
18
+ def header_param(name, type, required)
19
19
  parameter do
20
20
  key :name, name
21
21
  key :in, :header
22
- key :required, true
22
+ key :required, required
23
23
  key :type, type
24
24
  end
25
25
  end
@@ -35,20 +35,20 @@ module Swagger
35
35
  end
36
36
  end
37
37
 
38
- def query_param(name, type)
38
+ def query_param(name, type, required)
39
39
  parameter do
40
40
  key :name, name
41
41
  key :in, :query
42
- key :required, true
42
+ key :required, required
43
43
  key :type, type
44
44
  end
45
45
  end
46
46
 
47
- def path_param(name, type)
47
+ def path_param(name, type, required)
48
48
  parameter do
49
49
  key :name, name
50
50
  key :in, :path
51
- key :required, true
51
+ key :required, required
52
52
  key :type, type
53
53
  end
54
54
  end
@@ -13,9 +13,9 @@ module ApiSchema
13
13
  @query_params = []
14
14
  end
15
15
 
16
- HeaderParam = ::Struct.new(:name, :type)
17
- PathParam = ::Struct.new(:name, :type)
18
- QueryParam = ::Struct.new(:name, :type)
16
+ HeaderParam = ::Struct.new(:name, :type, :required)
17
+ PathParam = ::Struct.new(:name, :type, :required)
18
+ QueryParam = ::Struct.new(:name, :type, :required)
19
19
 
20
20
  attr_reader :method, :summary, :description, :header_params, :body_param,
21
21
  :path_params, :query_params, :resp,
@@ -33,20 +33,20 @@ module ApiSchema
33
33
  @description = desc
34
34
  end
35
35
 
36
- def header(name, type)
37
- @header_params << HeaderParam.new(name, type)
36
+ def header(name, type, required: true)
37
+ @header_params << HeaderParam.new(name, type, required)
38
38
  end
39
39
 
40
40
  def body(body_param)
41
41
  @body_param = body_param
42
42
  end
43
43
 
44
- def path_param(name, type)
45
- @path_params << PathParam.new(name, type)
44
+ def path_param(name, type, required: true)
45
+ @path_params << PathParam.new(name, type, required)
46
46
  end
47
47
 
48
- def query_param(name, type)
49
- @query_params << QueryParam.new(name, type)
48
+ def query_param(name, type, required: true)
49
+ @query_params << QueryParam.new(name, type, required)
50
50
  end
51
51
 
52
52
  def response(code, model_name = nil, &block)
@@ -106,13 +106,13 @@ module ApiSchema
106
106
  body_param(r.body_param) if r.with_body?
107
107
 
108
108
  r.header_params.each do |p|
109
- header_param(p.name, p.type)
109
+ header_param(p.name, p.type, p.required)
110
110
  end
111
111
  r.path_params.each do |p|
112
- path_param(p.name, p.type)
112
+ path_param(p.name, p.type, p.required)
113
113
  end
114
114
  r.query_params.each do |p|
115
- query_param(p.name, p.type)
115
+ query_param(p.name, p.type, p.required)
116
116
  end
117
117
 
118
118
  success_response(r.resp.code, r.resp.model, r.resp.fields)
@@ -1,3 +1,3 @@
1
1
  module ApiSchema
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Chopey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport