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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90690a0d83cc8cc7f5ceea8bac821b5e37a4041c8f86422dcc46e0441ba6e274
4
- data.tar.gz: 6a4c83180bd090e1b8e64eec029cbb3074a53b66c37a92de6ab0abba1032704f
3
+ metadata.gz: b271de6e69e7310b83a0e0a4272291207ab1b2b21356e77ced5d78d38c1884af
4
+ data.tar.gz: 5a7e2ce5a172e446acea51b9c8f046b778942d61a9947307e378122d30873264
5
5
  SHA512:
6
- metadata.gz: 223b02240830989e6f7c16d0e0cea2ae124af88a71ef4c75cf302085803bee46975fe2f7485161cc83aa0824ea80617c4df44e5b7896d65d579c27272cc3f99b
7
- data.tar.gz: 32fe39dadf86fe81880657b42e113a80bc23a58da82e962515738fef898856b8b2e2e7e5bf4088cb58a9919a83ab352d7cd4d281e581d3887daae75b86279136
6
+ metadata.gz: 565ebc2d98a7f6b3aa32e1c9a8735cbbfeaf7b482f4fff4a51078dcc27454942765fc05a90f1eb7183c63245144046e422c4a6216ce942d3a068a4d2fb97c29a
7
+ data.tar.gz: 35ed85d6f2f209754acba27f472864eb1cf5fb3a16652612ee0ad7886cfc4129d3da7713d0bef7cc94840c2ba296626fa77710c38dbfced631ae478b4f01e59b
data/Gemfile CHANGED
@@ -4,7 +4,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'fast_jsonapi'
8
7
  gem 'jwt'
9
8
 
10
9
  group :test do
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.4'
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 10
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
@@ -0,0 +1,5 @@
1
+ class String
2
+ def underscore
3
+ gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-", "_").downcase
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module ApiPack
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.3.1'.freeze
3
3
  end
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.2.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-03-29 00:00:00.000000000 Z
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.0.9
96
+ rubygems_version: 3.2.15
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Api requirements