api_pack 1.2.1 → 1.3.1
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 +4 -4
- data/Gemfile +0 -1
- data/README.md +2 -38
- data/lib/api_pack.rb +1 -1
- data/lib/api_pack/support/undescore.rb +5 -0
- data/lib/api_pack/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b271de6e69e7310b83a0e0a4272291207ab1b2b21356e77ced5d78d38c1884af
|
4
|
+
data.tar.gz: 5a7e2ce5a172e446acea51b9c8f046b778942d61a9947307e378122d30873264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 565ebc2d98a7f6b3aa32e1c9a8735cbbfeaf7b482f4fff4a51078dcc27454942765fc05a90f1eb7183c63245144046e422c4a6216ce942d3a068a4d2fb97c29a
|
7
|
+
data.tar.gz: 35ed85d6f2f209754acba27f472864eb1cf5fb3a16652612ee0ad7886cfc4129d3da7713d0bef7cc94840c2ba296626fa77710c38dbfced631ae478b4f01e59b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ ruby >= 2.4
|
|
24
24
|
Add this line to your application's Gemfile:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
gem 'api_pack', '~> 1.1
|
27
|
+
gem 'api_pack', '~> 1.3.1'
|
28
28
|
```
|
29
29
|
|
30
30
|
And then execute:
|
@@ -143,46 +143,10 @@ module ExceptionHandler
|
|
143
143
|
end
|
144
144
|
```
|
145
145
|
|
146
|
-
### Serializer Parser Adapter (BETA)
|
147
|
-
|
148
|
-
This Parser aims to provide adapters for using serializers like FastJsonApi
|
149
|
-
|
150
|
-
Default is FastJsonApi
|
151
|
-
|
152
|
-
By convection the serializers should be in
|
153
|
-
|
154
|
-
serializers/name_serializer/class_serializer
|
155
|
-
|
156
|
-
Ex: serializers/fast_jsonapi/user_serializer.rb
|
157
|
-
|
158
|
-
USAGE:
|
159
|
-
- Create initializer serilializer_parser.rb and put this code
|
160
|
-
|
161
|
-
|
162
|
-
```ruby
|
163
|
-
ApiPack::Serializer::Parser.adapter = :fast_json_api
|
164
|
-
```
|
165
|
-
|
166
|
-
- include ApiPack::ApiHelper in aplication_controler.rb
|
167
|
-
|
168
|
-
```ruby
|
169
|
-
class ApplicationController < ActionController::API
|
170
|
-
include ApiPack::ApiHelper
|
171
|
-
end
|
172
|
-
```
|
173
|
-
- use method serializer_hash to return an hash
|
174
|
-
|
175
|
-
```ruby
|
176
|
-
def index
|
177
|
-
users = User.all
|
178
|
-
|
179
|
-
render json: serializer_hash(users, :user)
|
180
|
-
end
|
181
|
-
```
|
182
146
|
## Pagination Links
|
183
147
|
- pagination_meta_generator \
|
184
148
|
Return an hash with pagination links
|
185
|
-
- Apipack has default per page like
|
149
|
+
- Apipack has default per page like 5
|
186
150
|
- To change o defaut_per_page create an initializer api_pack and put this code
|
187
151
|
|
188
152
|
```ruby
|
data/lib/api_pack.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'jwt'
|
2
|
-
require 'fast_jsonapi'
|
3
2
|
require 'api_pack/version'
|
4
3
|
require 'api_pack/api_helper'
|
5
4
|
require 'api_pack/json_web_token'
|
@@ -11,6 +10,7 @@ require 'api_pack/errors/api_errors_serializer'
|
|
11
10
|
require 'api_pack/errors/validation_error_serializer'
|
12
11
|
require 'api_pack/errors/validation_errors_serializer'
|
13
12
|
require 'api_pack/support/helper'
|
13
|
+
require 'api_pack/support/undescore'
|
14
14
|
require 'api_pack/serializer/parser'
|
15
15
|
|
16
16
|
module ApiPack
|
data/lib/api_pack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/api_pack/serializer/adapter/fast_json_api.rb
|
73
73
|
- lib/api_pack/serializer/parser.rb
|
74
74
|
- lib/api_pack/support/helper.rb
|
75
|
+
- lib/api_pack/support/undescore.rb
|
75
76
|
- lib/api_pack/version.rb
|
76
77
|
homepage: https://github.com/Jllima/api_pack
|
77
78
|
licenses:
|
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.2.15
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Api requirements
|