cucumber-rest-bdd 0.5.3 → 0.6.0.pre.183

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.
@@ -1,4 +1,7 @@
1
1
  def get_url(path)
2
2
  raise %/Please set an 'endpoint' environment variable provided with the url of the api/ if !ENV.has_key?('endpoint')
3
- url = %/#{ENV['endpoint']}#{path}/
3
+ url = ENV['endpoint']
4
+ url = "#{url}/" unless url.end_with?("/")
5
+ url = "#{url}#{@urlbasepath}/" unless @urlbasepath.to_s.empty?
6
+ url = "#{url}#{path}" unless path.empty?
4
7
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-rest-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0.pre.183
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Bragg
8
+ - Matt Hosking
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2017-01-10 00:00:00.000000000 Z
12
+ date: 2018-07-09 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: cucumber-api
@@ -16,21 +17,24 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '0.4'
20
+ version: '0.6'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '0.4'
27
+ version: '0.6'
27
28
  - !ruby/object:Gem::Dependency
28
- name: activesupport
29
+ name: cucumber-expressions
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
34
  version: '5.0'
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 5.0.17
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +42,23 @@ dependencies:
38
42
  - - "~>"
39
43
  - !ruby/object:Gem::Version
40
44
  version: '5.0'
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 5.0.17
48
+ - !ruby/object:Gem::Dependency
49
+ name: activesupport
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.1'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.1'
41
62
  - !ruby/object:Gem::Dependency
42
63
  name: easy_diff
43
64
  requirement: !ruby/object:Gem::Requirement
@@ -55,32 +76,16 @@ dependencies:
55
76
  description: Series of BDD cucumber rules for testing API endpoints
56
77
  email:
57
78
  - harry.bragg@graze.com
79
+ - Matt.Hosking@alintaenergy.com.au
58
80
  executables: []
59
81
  extensions: []
60
82
  extra_rdoc_files: []
61
83
  files:
62
- - ".gitignore"
63
- - ".travis.yml"
64
- - Dockerfile
65
- - LICENSE
66
- - Makefile
67
- - README.md
68
- - STEPS.md
69
- - cucumber-rest-bdd.gemspec
70
- - docker-compose.yml
71
- - features/errors.feature
72
- - features/functional.feature
73
- - features/grabs.feature
74
- - features/headers.feature
75
- - features/levels.feature
76
- - features/methods.feature
77
- - features/response.feature
78
- - features/status.feature
79
- - features/support/env.rb
80
- - features/types.feature
81
84
  - lib/cucumber-rest-bdd.rb
85
+ - lib/cucumber-rest-bdd/data.rb
82
86
  - lib/cucumber-rest-bdd/hash.rb
83
87
  - lib/cucumber-rest-bdd/level.rb
88
+ - lib/cucumber-rest-bdd/list.rb
84
89
  - lib/cucumber-rest-bdd/steps.rb
85
90
  - lib/cucumber-rest-bdd/steps/functional.rb
86
91
  - lib/cucumber-rest-bdd/steps/resource.rb
@@ -88,10 +93,7 @@ files:
88
93
  - lib/cucumber-rest-bdd/steps/status.rb
89
94
  - lib/cucumber-rest-bdd/types.rb
90
95
  - lib/cucumber-rest-bdd/url.rb
91
- - server/db.json
92
- - server/error.js
93
- - server/routes.json
94
- homepage: http://github.com/graze/cucumber-rest-bdd
96
+ homepage: https://github.com/graze/cucumber-rest-bdd
95
97
  licenses:
96
98
  - MIT
97
99
  metadata: {}
@@ -106,12 +108,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
108
  version: '0'
107
109
  required_rubygems_version: !ruby/object:Gem::Requirement
108
110
  requirements:
109
- - - ">="
111
+ - - ">"
110
112
  - !ruby/object:Gem::Version
111
- version: '0'
113
+ version: 1.3.1
112
114
  requirements: []
113
115
  rubyforge_project:
114
- rubygems_version: 2.6.8
116
+ rubygems_version: 2.7.7
115
117
  signing_key:
116
118
  specification_version: 4
117
119
  summary: BDD Rest API specifics for cucumber
data/.gitignore DELETED
@@ -1,50 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- # Used by dotenv library to load environment variables.
14
- # .env
15
-
16
- ## Specific to RubyMotion:
17
- .dat*
18
- .repl_history
19
- build/
20
- *.bridgesupport
21
- build-iPhoneOS/
22
- build-iPhoneSimulator/
23
-
24
- ## Specific to RubyMotion (use of CocoaPods):
25
- #
26
- # We recommend against adding the Pods directory to your .gitignore. However
27
- # you should judge for yourself, the pros and cons are mentioned at:
28
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
- #
30
- # vendor/Pods/
31
-
32
- ## Documentation cache and generated files:
33
- /.yardoc/
34
- /_yardoc/
35
- /doc/
36
- /rdoc/
37
-
38
- ## Environment normalization:
39
- /.bundle/
40
- /vendor/bundle
41
- /lib/bundler/man/
42
-
43
- # for a library or gem, you might want to ignore these files since the code is
44
- # intended to run in multiple environments; otherwise, check them in:
45
- # Gemfile.lock
46
- # .ruby-version
47
- # .ruby-gemset
48
-
49
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
- .rvmrc
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- language: shell
2
- sudo: required
3
- services:
4
- - docker
5
- install:
6
- - make build
7
- script:
8
- - make test
9
- deploy:
10
- - provider: rubygems
11
- api_key:
12
- secure: obDis+hzVaV8Dk0i2V9bd3QiFhjdEpMZ6SxmTWDnbLcnYuhJyY7VPO3Jk9hINAWZPxH//uByVT+5p2r3YpmKUQxxoMtqJ7R8+aybfvlrDC9ZNoyE6lYF/Ysnj03pXMA5qwfqXt5ZVZuMvqAUj8J3sQBRSFwq7f/tlsAQdG1nowPL9lkxqOE++z+WvMvzkTs4x2RosrBg81eFNiCe0XKUXQGFbIneUA34Xjf/Mg+dls0UckyKBJO/3yoq3aCjYAaMGeA0UtfXwVqBdv7xhv8edzuJwbwrnstgQmwk6pR6XVIPff8wqHvRMHRXcFlPvRYv9WW4/CIxi6nvdpSlgeVXs9q1I22Z7f5sJy0As41wLoG95NVokqb2tFRz7ZwZU6tFNsJvK2tO8Bas0Gx6KTTThb2NTNdWQFczYBI/ERtYUB9qVRVlPDsK+iLRmFLi71H50aSbwnuXGEAfinXRmXvpLgPe1ZMYxMq+uz/ETBpCBfD26FQm3ieXIEb92GG7eswbIyv/LktCglEhNXR6FImqf1Ni2OOSXskJH+DTGnOkDHVFq5AhGQ8MtvJdsnJdm4p3PKzddzMPJ58cTwDOEd4uq7uNR/PGtE1w5FE3FNVIXr5ny1f9CpDwMpLL9xQ/AbgV9bJxBzqseBvXhn3HondJyZld1rfiUopvz/XGrydRvAo=
13
- gem: cucumber-rest-bdd
14
- on:
15
- branch: master
16
- repo: graze/cucumber-rest-bdd
17
- - provider: rubygems
18
- api_key:
19
- secure: obDis+hzVaV8Dk0i2V9bd3QiFhjdEpMZ6SxmTWDnbLcnYuhJyY7VPO3Jk9hINAWZPxH//uByVT+5p2r3YpmKUQxxoMtqJ7R8+aybfvlrDC9ZNoyE6lYF/Ysnj03pXMA5qwfqXt5ZVZuMvqAUj8J3sQBRSFwq7f/tlsAQdG1nowPL9lkxqOE++z+WvMvzkTs4x2RosrBg81eFNiCe0XKUXQGFbIneUA34Xjf/Mg+dls0UckyKBJO/3yoq3aCjYAaMGeA0UtfXwVqBdv7xhv8edzuJwbwrnstgQmwk6pR6XVIPff8wqHvRMHRXcFlPvRYv9WW4/CIxi6nvdpSlgeVXs9q1I22Z7f5sJy0As41wLoG95NVokqb2tFRz7ZwZU6tFNsJvK2tO8Bas0Gx6KTTThb2NTNdWQFczYBI/ERtYUB9qVRVlPDsK+iLRmFLi71H50aSbwnuXGEAfinXRmXvpLgPe1ZMYxMq+uz/ETBpCBfD26FQm3ieXIEb92GG7eswbIyv/LktCglEhNXR6FImqf1Ni2OOSXskJH+DTGnOkDHVFq5AhGQ8MtvJdsnJdm4p3PKzddzMPJ58cTwDOEd4uq7uNR/PGtE1w5FE3FNVIXr5ny1f9CpDwMpLL9xQ/AbgV9bJxBzqseBvXhn3HondJyZld1rfiUopvz/XGrydRvAo=
20
- gem: cucumber-rest-bdd
21
- on:
22
- tags: true
23
- repo: graze/cucumber-rest-bdd
data/Dockerfile DELETED
@@ -1,24 +0,0 @@
1
- FROM ruby
2
-
3
- MAINTAINER "Harry Bragg <harry.bragg@graze.com>"
4
- LABEL version="0.5.3" \
5
- license="MIT"
6
-
7
- COPY . /usr/local/cucumber-rest-bdd
8
- WORKDIR /usr/local/cucumber-rest-bdd
9
-
10
- RUN gem build cucumber-rest-bdd.gemspec \
11
- && gem install cucumber-rest-bdd-*.gem \
12
- && rm -rf /usr/local/cucumber-rest-bdd
13
-
14
- WORKDIR /opt/src
15
-
16
- ENV field_separator=_
17
- ENV field_camel=false
18
- ENV resource_single=false
19
- ENV cucumber_api_verbose=false
20
- ENV data_key=
21
- ENV error_key=error
22
- ENV set_parent_id=false
23
-
24
- CMD ["cucumber"]
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 graze.com
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/Makefile DELETED
@@ -1,15 +0,0 @@
1
- TAG := graze/cucumber-rest-bdd
2
- RUN := docker run --rm -it -v $(PWD):/opt/src -w /opt/src ${TAG}
3
-
4
- build:
5
- docker-compose build runner
6
-
7
- test: start-test-server
8
- docker-compose run --rm runner cucumber --order random --format progress
9
- make stop-test-server > /dev/null 2>&1 &
10
-
11
- start-test-server: stop-test-server
12
- docker-compose up -d test-server
13
-
14
- stop-test-server:
15
- docker-compose stop test-server
data/README.md DELETED
@@ -1,338 +0,0 @@
1
- # Cucumber Rest BDD
2
-
3
- [![Build Status](https://travis-ci.org/graze/cucumber-rest-bdd.svg?branch=master)](https://travis-ci.org/graze/cucumber-rest-bdd)
4
- [![](https://images.microbadger.com/badges/image/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own image badge on microbadger.com")
5
- [![](https://images.microbadger.com/badges/version/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own version badge on microbadger.com")
6
- [![](https://images.microbadger.com/badges/license/graze/cucumber-rest-bdd.svg)](https://microbadger.com/images/graze/cucumber-rest-bdd "Get your own license badge on microbadger.com")
7
- [![Gem Version](https://badge.fury.io/rb/cucumber-rest-bdd.svg)](https://badge.fury.io/rb/cucumber-rest-bdd)
8
-
9
- A set of Behavioural tests that can be run against a REST API.
10
-
11
- ![Giphy](https://media3.giphy.com/media/Tv7VPg6Os488g/giphy.gif)
12
-
13
- This is based from: http://gregbee.ch/blog/effective-api-testing-with-cucumber
14
-
15
- A list of [Steps](STEPS.md) shows the comparison between Behavioural and Functional tests provided by this package.
16
-
17
- ## Usage
18
-
19
- You can include this as a gem in your features, or run directly through docker
20
-
21
- **Gem:**
22
-
23
- ```bash
24
- $ gem install cucumber-rest-bdd
25
- ```
26
-
27
- **Docker:**
28
- ```bash
29
- $ docker run --rm -v $(pwd):/opt/src -e endpoint=http://server/ graze/cucumber-rest-bdd
30
- ```
31
-
32
- ## Configuration
33
-
34
- The following environment variables modify how this will operate:
35
-
36
- - `endpoint` - (string) the base url to call for each request
37
- - `data_key` - (string) the root data key (if applicable) (for example: `"data"` if all responses have a `{"data":{}}` field)
38
- - `error_key` - (string) this will ignore the `data_key` when checking for errors
39
- - `field_separator` - (string) the separator used between words by the api
40
- - `field_camel` - (bool [`true`|`false`]) does this endpoint use camelCase for fields (default: `false`)
41
- - `resource_single` - (bool [`true`|`false`]) if each resource should be singularized or not (default: `false`)
42
- - `set_parent_id` - (bool [`true`|`false`]) when creating sub resources, automatically add parent ids
43
-
44
- ## Examples
45
-
46
- - For a full list of steps see: [STEPS](STEPS.md)
47
- - These examples are taken from the test [features](features)
48
-
49
- ### Retrieve items
50
-
51
- ```gherkin
52
- Given I am a client
53
- When I request the post "1"
54
- Then the request was successful
55
- And the response has the following attributes:
56
- | attribute | type | value |
57
- | User Id | numeric | 1 |
58
- | Id | numeric | 1 |
59
- | Title | string | sunt aut facere repellat provident occaecati excepturi optio reprehenderit |
60
- | Body | string | quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto |
61
- ```
62
-
63
- ```gherkin
64
- Given I am a client
65
- When I request the photo "1" for album "1" for user "1"
66
- Then the request was successful
67
- And the response has the attributes:
68
- | attribute | type | value |
69
- | title | string | accusamus beatae ad facilis cum similique qui sunt |
70
- ```
71
-
72
- ```gherkin
73
- Given I am a client
74
- When I request a list of posts with:
75
- | User Id | 2 |
76
- Then the request is successful
77
- And the response is a list of at least 2 posts
78
- And one response has the following attributes:
79
- | attribute | type | value |
80
- | User Id | numeric | 2 |
81
- | Id | numeric | 11 |
82
- | Title | string | et ea vero quia laudantium autem |
83
- | Body | string | delectus reiciendis molestiae occaecati non minima eveniet qui voluptatibus\\naccusamus in eum beatae sit\\nvel qui neque voluptates ut commodi qui incidunt\nut animi commodi |
84
- ```
85
-
86
- You can inspect child objects by using `:` in between the names
87
-
88
- ```gherkin
89
- Given I am a client
90
- When I request the comment "1" with:
91
- | `_expand` | post |
92
- Then the response has the following attributes:
93
- | attribute | type | value |
94
- | name | string | id labore ex et quam laborum |
95
- | email | string | Eliseo@gardner.biz |
96
- | body | string | laudantium enim quasi est quidem magnam voluptate ipsam eos\\ntempora quo necessitatibus\\ndolor quam autem quasi\\nreiciendis et nam sapiente accusantium |
97
- | post : title | string | sunt aut facere repellat provident occaecati excepturi optio reprehenderit |
98
- | post : body | string | quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto |
99
- ```
100
-
101
- Alternatively you can inspect child arrays and objects by describing the path of the object with attributes
102
-
103
- ```gherkin
104
- Given I am a client
105
- When I set JSON request body to:
106
- """
107
- {"title":"test","body":"multiple",
108
- "comments":[
109
- {"common":1,"id":1,"title":"fish","body":"cake","image":{"href":"some_url"}},
110
- {"common":1,"id":2,"title":"foo","body":"bar","image":{"href":"some_url"}}
111
- ]}
112
- """
113
- And I send a POST request to "http://test-server/posts"
114
- Then the response has the attributes:
115
- | attribute | type | value |
116
- | title | string | test |
117
- | body | string | multiple |
118
- And the response has a list of comments
119
- And the response has a list of 2 comments
120
- And the response has two comments with attributes:
121
- | attribute | type | value |
122
- | common | integer | 1 |
123
- And the response has two comments with an image with attributes:
124
- | attribute | type | value |
125
- | href | string | some_url |
126
- And the response has one comment with attributes:
127
- | attribute | type | value |
128
- | Id | integer | 1 |
129
- | Title | string | fish |
130
- | Body | string | cake |
131
- And the response has one comment with attributes:
132
- | attribute | type | value |
133
- | Id | integer | 2 |
134
- | Title | string | foo |
135
- | Body | string | bar |
136
- ```
137
-
138
- Each numeric request can be prefixed with a modifier to modify the number specified
139
-
140
- ```gherkin
141
- Given I am a client
142
- When I request a list of posts with:
143
- | `_embed` | comments |
144
- Then the response is a list of posts
145
- Then the response is a list of more than 5 posts
146
- Then the response is a list of at least 10 posts
147
- Then more than three posts have the attributes:
148
- | attribute | type | value |
149
- | User Id | integer | 5 |
150
- Then less than 200 posts have more than four comments
151
- Then more than 50 posts have less than six comments
152
- Then more than 80 posts have a list of comments
153
- Then at least 90 posts have a list of five comments
154
- Then more than 10 posts have five comments
155
- Then less than 200 posts have five comments
156
- ```
157
-
158
- #### Errors
159
-
160
- If the `error_key` environment variable is set, if that key is used as the initial step it will ignore any `data_key`
161
- setting.
162
-
163
- Example: `error_key=error`, `data_key=data`
164
-
165
- ```gherkin
166
- Then the response has a list of posts | {"data":[{"id": 12}]}
167
-
168
- Then the response has one error | {"errors":[{"message": "Error"}]}
169
-
170
- Then the response has an error | {"error": {"message": "Error}}
171
- ```
172
-
173
- Example: `error_key=`, `data_key=data`
174
-
175
- ```gherkin
176
- Then the response has a list of posts | {"data":[{"id": 12}]}
177
-
178
- Then the response has one error | {"data": {"errors":[{"message": "Error"}]}}
179
-
180
- Then the response has an error | {"data": {"error": {"message": "Error}}}
181
- ```
182
-
183
- ### Creation
184
-
185
- ```gherkin
186
- Given I am a client
187
- When I request to create a post with:
188
- | attribute | type | value |
189
- | Title | string | foo |
190
- | Body | string | bar |
191
- | User Id | numeric | 1 |
192
- Then the request is successful and a post was created
193
- And the response has the following attributes:
194
- | attribute | type | value |
195
- | User Id | numeric | 1 |
196
- | Title | string | foo |
197
- | Body | string | bar |
198
- ```
199
-
200
- If the environment variable: `set_parent_id` is set to `true` then when you create sub resources it will add the level aboves id into the json, otherwise it will rely on the api to do it for you
201
-
202
- ```gherkin
203
- Given I am a client
204
- When I request to create a photo in album "2" for user "1" with:
205
- | attribute | type | value |
206
- | title | string | foo |
207
- Then the comment was created
208
- And the response has the attributes:
209
- | attribute | type | value |
210
- | Album Id | int | 2 |
211
- | Title | string | foo |
212
- When I request a list of photos for album "2" for user "1"
213
- Then the request was successful
214
- And one comment has the attributes:
215
- | attribute | type | value |
216
- | Title | string | foo |
217
- ```
218
-
219
- ### Removal
220
-
221
- ```gherkin
222
- Given I am a client
223
- When I request to remove the post "20"
224
- Then the request is successful
225
- ```
226
-
227
- ### Modification
228
-
229
- ```gherkin
230
- Given I am a client
231
- When I request to modify the post "21" with:
232
- | attribute | type | value |
233
- | Title | string | foo |
234
- Then the request is successful
235
- And the response has the following attributes:
236
- | attribute | type | value |
237
- | User Id | numeric | 3 |
238
- | Title | string | foo |
239
- | Body | string | repellat aliquid praesentium dolorem quo\\nsed totam minus non itaque\\nnihil labore molestiae sunt dolor eveniet hic recusandae veniam\\ntempora et tenetur expedita sunt |
240
- ```
241
-
242
- ### Multiple Requests
243
-
244
- ```gherkin
245
- Given I am a client
246
- When I request to create a post with:
247
- | attribute | type | value |
248
- | Title | string | foo |
249
- | Body | string | bar |
250
- | User Id | integer | 12 |
251
- Then the request is successful
252
- When I save "id"
253
- And I request the post "{id}"
254
- Then the request is successful
255
- And the response has the following attributes:
256
- | attribute | type | value |
257
- | Title | string | foo |
258
- | Body | string | bar |
259
- | User Id | numeric | 12 |
260
- | Id | numeric | {id} |
261
- ```
262
-
263
- ## Resources
264
-
265
- A resource "name" is attempted to be retrieved from the given name of the item to be retrieved. This pluralises, ensures everything is lower case, removes any unparameterisable characters and uses a `-` separator.
266
-
267
- ```
268
- Token -> tokens
269
- User -> users
270
- Big Life -> big-lifes
271
- octopus -> octopi
272
- ```
273
-
274
- If the environment variable: `resource_single` is set to `true` then it will not attempt to pluralise the resources.
275
-
276
- ```
277
- Token -> token
278
- User -> user
279
- ```
280
-
281
- You can directly pass what you want using:
282
- ```
283
- `field`
284
- ```
285
- this will not modify the field.
286
-
287
- ## Attributes
288
-
289
- ### Types
290
-
291
- Attribute types:
292
- The following types are supported:
293
-
294
- | type | other names | example |
295
- |---------|-----------------------|-----------|
296
- | integer | numeric, number, long | 12 |
297
- | float | double, decimal | 4.8 |
298
- | string | text | "text" |
299
- | array | array | ["a"] |
300
- | object | object | {"a":"b"} |
301
- | null | nil | |
302
- | bool | boolean | true |
303
-
304
- ### Name conversion
305
-
306
- attributes are converted into singular parametrised versions of the provided name:
307
-
308
- The conversion is based on the provided environment variables `field_camel` and `field_separator`
309
-
310
- **Default**
311
- ```
312
- field_camel=false
313
- field_separator=_
314
-
315
- Someid -> someid
316
- Product Id -> product_id
317
- Bodies -> body
318
- ```
319
-
320
- **CamelCase**
321
- ```
322
- field_camel=true
323
- field_separator=_
324
-
325
- Someid -> someid
326
- Product Id -> productId
327
- Bodies -> body
328
- ```
329
-
330
- **Other separator**
331
- ```
332
- field_camel=false
333
- field_separator=-
334
-
335
- Someid -> someid
336
- Product Id -> product-id
337
- Bodies -> body
338
- ```