rspec-rails-api 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: dd54b9e82ea28dd61a4741ed3bc758b6ea4fdefe58dc55e3d1034f7d21b66740
4
- data.tar.gz: a619a33620956af983cb443a8ce2e591b34a449641d983760714f58f06096a8b
3
+ metadata.gz: ca1fda3905c2dd0831009c51f1cf41aa75538aed6f635b87cb12828e5db69476
4
+ data.tar.gz: e965376d3c9c53a55537333f55b9c6165d23335f78b8ca4d030fa815dae0791b
5
5
  SHA512:
6
- metadata.gz: ba2e3a9cb38a2cb9147994f4870c31fe610fbbab96bef8d9b1416f0e7d7d142478d0163a2d8fcac1fa453a419cc3b9c482b6dcc4ff7e3cf3e7b77ee9fdec1e93
7
- data.tar.gz: 6bcd3b295c0e56c5e429ebae3cb84086cbfeb0ca10172f397f4de436061b242248c1cbb1e2841103b3ef8ad1261f3d11604634f35ea9f54a1683922069c98978
6
+ metadata.gz: 85a1a31174c7c674ccadcef0481dd249c7169f41e0aa8c3a52f1f542970948ca9e4a885900384871c2245e9b5c968d4f798e6d2d0b6e4284906c26bbd12c33ca
7
+ data.tar.gz: cb7d32f0db0d82961d2f43647c6b65d6000e4a6605e9439806d3534ad7dccd79122a9659c06c5f71bf737849260a2488afb978bde83f3675587dfb9ec0b0a131
data/README.md CHANGED
@@ -241,7 +241,7 @@ Defines the path parameters that are used in the URL.
241
241
  on_get '/api/users/:id/posts/:post_slug?full=:full_post' do
242
242
  path_params id: type: :integer, description: 'The user ID',
243
243
  post_slug: type: :string, description: 'The post slug',
244
- full_post: type: :boolean, required: false, description: 'Returns the full post if `true`, or only an excerpt',
244
+ full_post: type: :boolean, required: false, description: 'Returns the full post if `true`, or only an excerpt'
245
245
 
246
246
  # ...
247
247
  end
@@ -271,7 +271,7 @@ end
271
271
  An attribute should have the following form:
272
272
 
273
273
  ```
274
- <attr_name>: {type: <type>, desc: <description>, required: <required>, properties: <another_hash> }
274
+ <attr_name>: {type: <type>, desc: <description>, required: <required>, properties: <another_hash>, of: <another_hash> }
275
275
  ```
276
276
 
277
277
  - `attr_name` is the attribute name (sic)
@@ -279,6 +279,7 @@ An attribute should have the following form:
279
279
  `type` can be `:object` if the attribute contains other attributes.
280
280
  - `required` is optional an defaults to `false`.
281
281
  - `properties` is a hash of params and is only used if `type: :object`
282
+ - `of` is a hash of params and is only used if `type: :array`
282
283
 
283
284
  ##### `for_code(http_status, description, doc_only: false &block)`
284
285
 
@@ -163,15 +163,15 @@ module RSpec
163
163
  end
164
164
 
165
165
  def fill_request_param(field)
166
- if field[:type] && field[:type] == :object
167
- organize_params field[:properties] if field[:properties]
166
+ if field[:type] == :object && field[:properties]
167
+ organize_params field[:properties]
168
168
  else
169
169
  properties = {
170
170
  type: field[:type].to_s,
171
171
  description: field[:description] || nil,
172
172
  }
173
173
 
174
- properties[:items] = {} if field[:type] == :array
174
+ properties[:items] = organize_params field[:of] if field[:type] == :array && field[:of]
175
175
  properties
176
176
  end
177
177
  end
@@ -3,7 +3,7 @@
3
3
  module RSpec
4
4
  module Rails
5
5
  module Api
6
- VERSION = '0.1.3'
6
+ VERSION = '0.1.4'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Tancoigne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport