grape-entity 0.7.1 → 0.9.0

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: 31f997094eb9145e0e34541cc1083562afbc7724f68c343d9bb8f897b1af8c5f
4
- data.tar.gz: 271397df6ac51ffdd5e6380a1e4ab47affb3fbb14d805f6d00cc6715084d0f13
3
+ metadata.gz: 040fece8639b5fd085e4c77f1c88172e686e2655adf5e1cbb80aa0bb06c46faf
4
+ data.tar.gz: f688469ee710ac98ed822d41c3724f47d1ec8b6f9aa067eead52c07662c45121
5
5
  SHA512:
6
- metadata.gz: '0916c3b71d39463de13549202659f8e2c60634e6e6951b9999d45a045307c716f7bcada5a86c100066029a8e4f7da7aea5bf296bc8659f9a871162118c196d3d'
7
- data.tar.gz: ed8956de1f403808e504a60b3759e19a0012f9d91db9200fc63891f7d5f5bc29116084619bd47e41d8afce3ef8a98180c620c1f902b3f0dbd4eb42f37d4bb596
6
+ metadata.gz: 3f14751f855805e0ea16f5c232a67c70c76d7523075a93ad442de9a31c9eb04816c1deae576d0e68671f6126790e7ca7d96bc8a7da4aa7c61d06f00385863c69
7
+ data.tar.gz: 2d683f2414287de225b0d47e615f91563daf3b73c74e674c24cd2a1c6c2a417098ce0118e23d7272bf165d2895cb09fab824d52dfcb069dbfd8ea6e860b03b63
@@ -0,0 +1,14 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ day: "friday"
13
+ assignees:
14
+ - "LeFnord"
@@ -0,0 +1,26 @@
1
+ name: Rubocop
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ rubocop:
13
+ name: Rubocop
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: '3.0'
20
+ - run: gem install rubocop --no-doc
21
+ - run: rubocop --format progress --format json --out rubocop.json
22
+ id: rubocop
23
+ - uses: duderman/rubocop-annotate-action@v0.1.0
24
+ with:
25
+ path: rubocop.json
26
+ if: ${{ failure() }}
@@ -0,0 +1,26 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ spec:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ['2.6', '2.7', '3.0', head, jruby, truffleruby]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true
25
+ - name: Run rspec
26
+ run: bundle exec rspec
data/.rubocop.yml CHANGED
@@ -1,37 +1,86 @@
1
- AllCops:
2
- TargetRubyVersion: 2.4
3
- Include:
4
- - Dangerfile
1
+ inherit_from: .rubocop_todo.yml
5
2
 
3
+ AllCops:
6
4
  Exclude:
7
5
  - vendor/**/*
8
- - bin/**/*
9
- - Guardfile
6
+ - example/**/*
7
+ NewCops: enable
8
+ TargetRubyVersion: 3.0
9
+ SuggestExtensions: false
10
10
 
11
- inherit_from: .rubocop_todo.yml
12
-
13
- Gemspec/RequiredRubyVersion:
11
+ # Layout stuff
12
+ #
13
+ Layout/EmptyLinesAroundArguments:
14
14
  Enabled: false
15
15
 
16
- Naming/FileName:
16
+ Layout/EmptyLinesAroundAttributeAccessor:
17
+ Enabled: true
18
+
19
+ Layout/FirstHashElementIndentation:
20
+ EnforcedStyle: consistent
21
+
22
+ Layout/LineLength:
23
+ Max: 120
17
24
  Exclude:
18
- - 'Gemfile'
19
- - 'Rakefile'
20
- - 'grape-entity.gemspec'
21
- - 'lib/grape-entity.rb'
25
+ - spec/**/*
22
26
 
23
- Style/Documentation:
24
- Enabled: false
27
+ Layout/SpaceAroundMethodCallOperator:
28
+ Enabled: true
25
29
 
26
- Style/MultilineIfModifier:
27
- Enabled: false
30
+ # Lint stuff
31
+ #
32
+ Lint/ConstantDefinitionInBlock:
33
+ Enabled: true
34
+ Exclude:
35
+ - spec/**/*
28
36
 
29
- Style/RaiseArgs:
30
- Enabled: false
37
+ # Metrics stuff
38
+ #
39
+ Metrics/AbcSize:
40
+ Max: 25
41
+ IgnoredMethods:
42
+ # from lib/grape_entity/exposure/nesting_exposure.rb
43
+ - 'normalized_exposures'
44
+
45
+ Metrics/BlockLength:
46
+ Exclude:
47
+ - spec/**/*
31
48
 
32
- Lint/BooleanSymbol:
49
+ Metrics/CyclomaticComplexity:
50
+ Max: 13
51
+
52
+ Metrics/ClassLength:
53
+ Max: 300
54
+
55
+ Metrics/MethodLength:
56
+ Max: 26
33
57
  Exclude:
34
- - 'spec/grape_entity/exposure_spec.rb'
58
+ - spec/**/*
59
+
60
+ Metrics/PerceivedComplexity:
61
+ Max: 11
62
+ IgnoredMethods:
63
+ # from lib/grape_entity/entity.rb
64
+ - 'expose'
65
+ - 'merge_options'
66
+ # from lib/grape_entity/exposure/nesting_exposure.rb
67
+ - 'normalized_exposures'
35
68
 
36
- Lint/UnneededDisable:
69
+ # Naming stuff
70
+ #
71
+
72
+ Naming:
37
73
  Enabled: false
74
+
75
+ # Style stuff
76
+ #
77
+ Style/Documentation:
78
+ Enabled: false
79
+
80
+ Style/OptionalBooleanParameter:
81
+ AllowedMethods:
82
+ # from lib/grape_entity/condition/base.rb
83
+ - 'initialize'
84
+ # form lib/grape_entity/entity.rb
85
+ - 'entity_class'
86
+ - 'present_collection'
data/.rubocop_todo.yml CHANGED
@@ -1,47 +1,23 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-01-11 18:20:10 +0100 using RuboCop version 0.52.1.
3
+ # on 2020-11-07 00:01:40 UTC using RuboCop version 1.2.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- Lint/AmbiguousBlockAssociation:
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
11
13
  Exclude:
12
- - 'spec/grape_entity/exposure/represent_exposure_spec.rb'
14
+ - 'grape-entity.gemspec'
13
15
 
14
16
  # Offense count: 6
15
- Metrics/AbcSize:
16
- Max: 32
17
-
18
- # Offense count: 35
19
- # Configuration parameters: CountComments, ExcludedMethods.
20
- Metrics/BlockLength:
21
- Max: 1632
22
-
23
- # Offense count: 2
24
- # Configuration parameters: CountComments.
25
- Metrics/ClassLength:
26
- Max: 210
27
-
28
- # Offense count: 2
29
- Metrics/CyclomaticComplexity:
30
- Max: 11
31
-
32
- # Offense count: 7
33
- # Configuration parameters: CountComments.
34
- Metrics/MethodLength:
35
- Max: 28
36
-
37
- # Offense count: 2
38
- Metrics/PerceivedComplexity:
39
- Max: 13
40
-
41
- # Offense count: 1
42
- Style/EvalWithLocation:
17
+ # Cop supports --auto-correct.
18
+ Lint/BooleanSymbol:
43
19
  Exclude:
44
- - 'lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb'
20
+ - 'spec/grape_entity/exposure_spec.rb'
45
21
 
46
22
  # Offense count: 1
47
23
  # Cop supports --auto-correct.
@@ -50,9 +26,3 @@ Style/EvalWithLocation:
50
26
  Style/SymbolProc:
51
27
  Exclude:
52
28
  - 'spec/grape_entity/entity_spec.rb'
53
-
54
- # Offense count: 250
55
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
56
- # URISchemes: http, https
57
- Metrics/LineLength:
58
- Max: 146
data/CHANGELOG.md CHANGED
@@ -8,11 +8,52 @@
8
8
 
9
9
  * Your contribution here.
10
10
 
11
+
12
+ ### 0.9.0 (2021-03-20)
13
+
14
+ #### Features
15
+
16
+ * [#346](https://github.com/ruby-grape/grape-entity/pull/346): Ruby 3 support - [@LeFnord](https://github.com/LeFnord).
17
+
18
+
19
+ ### 0.8.2 (2020-11-08)
20
+
21
+ #### Fixes
22
+
23
+ * [#340](https://github.com/ruby-grape/grape-entity/pull/340): Preparations for 3.0 - [@LeFnord](https://github.com/LeFnord).
24
+ * [#338](https://github.com/ruby-grape/grape-entity/pull/338): Fix ruby 2.7 deprecation warning - [@begotten63](https://github.com/begotten63).
25
+
26
+
27
+ ### 0.8.1 (2020-07-15)
28
+
29
+ #### Fixes
30
+
31
+ * [#336](https://github.com/ruby-grape/grape-entity/pull/336): Pass options to delegators when they accept it - [@dnesteryuk](https://github.com/dnesteryuk).
32
+ * [#333](https://github.com/ruby-grape/grape-entity/pull/333): Fix typo in CHANGELOG.md - [@eitoball](https://github.com/eitoball).
33
+
34
+
35
+ ### 0.8.0 (2020-02-18)
36
+
37
+ #### Features
38
+
39
+ * [#307](https://github.com/ruby-grape/grape-entity/pull/307): Allow exposures to call methods defined in modules included in an entity - [@robertoz-01](https://github.com/robertoz-01).
40
+ * [#319](https://github.com/ruby-grape/grape-entity/pull/319): Support hashes with string keys - [@mhenrixon](https://github.com/mhenrixon).
41
+ * [#300](https://github.com/ruby-grape/grape-entity/pull/300): Loosens activesupport to 3 - [@ericschultz](https://github.com/ericschultz).
42
+
43
+ #### Fixes
44
+
45
+ * [#330](https://github.com/ruby-grape/grape-entity/pull/330): CI: use Ruby 2.5.7, 2.6.5, 2.7.0 - [@budnik](https://github.com/budnik).
46
+ * [#329](https://github.com/ruby-grape/grape-entity/pull/329): Option expose_nil doesn't work when block is passed - [@serbiant](https://github.com/serbiant).
47
+ * [#320](https://github.com/ruby-grape/grape-entity/pull/320): Gemspec: drop eol'd property rubyforge_project - [@olleolleolle](https://github.com/olleolleolle).
48
+ * [#307](https://github.com/ruby-grape/grape-entity/pull/307): Allow exposures to call methods defined in modules included in an entity - [@robertoz-01](https://github.com/robertoz-01).
49
+
50
+
11
51
  ### 0.7.1 (2018-01-30)
12
52
 
13
53
  #### Features
14
54
 
15
- * [#292](https://github.com/ruby-grape/grape-entity/pull/297): Introduce `override` option for expose (fixes [#286](https://github.com/ruby-grape/grape-entity/issues/296)) - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
55
+ * [#297](https://github.com/ruby-grape/grape-entity/pull/297): Introduce `override` option for expose (fixes [#286](https://github.com/ruby-grape/grape-entity/issues/296)) - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
56
+
16
57
 
17
58
  ### 0.7.0 (2018-01-25)
18
59
 
@@ -32,6 +73,7 @@
32
73
  * [#291](https://github.com/ruby-grape/grape-entity/pull/291): Refactor and simplify various classes and modules - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
33
74
  * [#292](https://github.com/ruby-grape/grape-entity/pull/292): Allow replace non-conditional non-nesting exposures in child classes (fixes [#286](https://github.com/ruby-grape/grape-entity/issues/286)) - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
34
75
 
76
+
35
77
  ### 0.6.1 (2017-01-09)
36
78
 
37
79
  #### Features
@@ -42,6 +84,7 @@
42
84
 
43
85
  * [#251](https://github.com/ruby-grape/grape-entity/pull/251): Avoid noise when code runs with Ruby warnings - [@cpetschnig](https://github.com/cpetschnig).
44
86
 
87
+
45
88
  ### 0.6.0 (2016-11-20)
46
89
 
47
90
  #### Features
@@ -53,6 +96,7 @@
53
96
  * [#249](https://github.com/ruby-grape/grape-entity/issues/249): Fix leaking of options and internals in default serialization - [@dblock](https://github.com/dblock), [@KingsleyKelly](https://github.com/KingsleyKelly).
54
97
  * [#248](https://github.com/ruby-grape/grape-entity/pull/248): Fix `nil` values causing errors when `merge` option passed - [@arempe93](https://github.com/arempe93).
55
98
 
99
+
56
100
  ### 0.5.2 (2016-11-14)
57
101
 
58
102
  #### Features
@@ -68,6 +112,7 @@
68
112
  * [#219](https://github.com/ruby-grape/grape-entity/pull/219): Double pass options in `serializable_hash` - [@sbatykov](https://github.com/sbatykov).
69
113
  * [#231](https://github.com/ruby-grape/grape-entity/pull/231), [#215](https://github.com/ruby-grape/grape-entity/issues/215): Allow `delegate_attribute` for derived entity - [@sbatykov](https://github.com/sbatykov).
70
114
 
115
+
71
116
  ### 0.5.1 (2016-4-4)
72
117
 
73
118
  #### Features
@@ -79,6 +124,7 @@
79
124
 
80
125
  * [#202](https://github.com/ruby-grape/grape-entity/pull/202): Reset `@using_class` memoization on `.setup` - [@rngtng](https://github.com/rngtng).
81
126
 
127
+
82
128
  ### 0.5.0 (2015-12-07)
83
129
 
84
130
  #### Features
@@ -99,18 +145,21 @@
99
145
  * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Serializing of deeply nested presenter exposures: [#155](https://github.com/ruby-grape/grape-entity/issues/155) - [@marshall-lee](https://github.com/marshall-lee).
100
146
  * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Deep projections (`:only`, `:except`) were unaware of nesting: [#156](https://github.com/ruby-grape/grape-entity/issues/156) - [@marshall-lee](https://github.com/marshall-lee).
101
147
 
148
+
102
149
  ### 0.4.8 (2015-08-10)
103
150
 
104
151
  #### Features
105
152
 
106
153
  * [#167](https://github.com/ruby-grape/grape-entity/pull/167), [#166](https://github.com/ruby-grape/grape-entity/issues/166): Regression with global settings (exposures, formatters) on `Grape::Entity` - [@marshall-lee](https://github.com/marshall-lee).
107
154
 
155
+
108
156
  ### 0.4.7 (2015-08-03)
109
157
 
110
158
  #### Features
111
159
 
112
160
  * [#164](https://github.com/ruby-grape/grape-entity/pull/164): Regression: entity instance methods were exposed with `NoMethodError`: [#163](https://github.com/ruby-grape/grape-entity/issues/163) - [@marshall-lee](https://github.com/marshall-lee).
113
161
 
162
+
114
163
  ### 0.4.6 (2015-07-27)
115
164
 
116
165
  #### Features
@@ -129,6 +178,7 @@
129
178
 
130
179
  * [#147](https://github.com/ruby-grape/grape-entity/pull/147), [#142](https://github.com/ruby-grape/grape-entity/pull/142): Private method values were not exposed with `safe` option - [@marshall-lee](https://github.com/marshall-lee).
131
180
 
181
+
132
182
  ### 0.4.5 (2015-03-10)
133
183
 
134
184
  #### Features
@@ -143,6 +193,7 @@
143
193
  * [#110](https://github.com/ruby-grape/grape-entity/pull/110): Safe exposure when using `Hash` models - [@croeck](https://github.com/croeck).
144
194
  * [#91](https://github.com/ruby-grape/grape-entity/pull/91): OpenStruct serializing - [@etehtsea](https://github.com/etehtsea).
145
195
 
196
+
146
197
  ### 0.4.4 (2014-08-17)
147
198
 
148
199
  #### Features
@@ -150,6 +201,7 @@
150
201
  * [#85](https://github.com/ruby-grape/grape-entity/pull/85): Added `present_collection` to indicate that an `Entity` presents an entire Collection - [@dspaeth-faber](https://github.com/dspaeth-faber).
151
202
  * [#85](https://github.com/ruby-grape/grape-entity/pull/85): Hashes can now be passed as object to be presented and the `Hash` keys can be referenced by expose - [@dspaeth-faber](https://github.com/dspaeth-faber).
152
203
 
204
+
153
205
  ### 0.4.3 (2014-06-12)
154
206
 
155
207
  #### Features
@@ -160,6 +212,7 @@
160
212
 
161
213
  * [#77](https://github.com/ruby-grape/grape-entity/pull/77): Compatibility with Rspec 3 - [@justfalter](https://github.com/justfalter).
162
214
 
215
+
163
216
  ### 0.4.2 (2014-04-03)
164
217
 
165
218
  #### Features
@@ -167,12 +220,14 @@
167
220
  * [#60](https://github.com/ruby-grape/grape-entity/issues/59): Performance issues introduced by nested exposures - [@AlexYankee](https://github.com/AlexYankee).
168
221
  * [#60](https://github.com/ruby-grape/grape-entity/issues/57): Nested exposure double-exposes a field - [@AlexYankee](https://github.com/AlexYankee).
169
222
 
223
+
170
224
  ### 0.4.1 (2014-02-13)
171
225
 
172
226
  #### Fixes
173
227
 
174
228
  * [#54](https://github.com/ruby-grape/grape-entity/issues/54): Fix: undefined method `to_set` - [@aj0strow](https://github.com/aj0strow).
175
229
 
230
+
176
231
  ### 0.4.0 (2014-01-27)
177
232
 
178
233
  #### Features
@@ -192,6 +247,7 @@
192
247
  * [#51](https://github.com/ruby-grape/grape-entity/pull/51): Raise `ArgumentError` if an unknown option is used with `expose` - [@aj0strow](https://github.com/aj0strow).
193
248
  * [#51](https://github.com/ruby-grape/grape-entity/pull/51): Alias `:with` to `:using`, consistently with the Grape api endpoints - [@aj0strow](https://github.com/aj0strow).
194
249
 
250
+
195
251
  ### 0.3.0 (2013-03-29)
196
252
 
197
253
  #### Features
@@ -200,12 +256,14 @@
200
256
  * The `instance.entity` method now optionally accepts `options` - [@mbleigh](https://github.com/mbleigh).
201
257
  * You can pass symbols to `:if` and `:unless` to simply check for truthiness/falsiness of the specified options key - [@mbleigh](https://github.com/mbleigh).
202
258
 
259
+
203
260
  ### 0.2.0 (2013-01-11)
204
261
 
205
262
  #### Features
206
263
 
207
264
  * Moved the namespace back to `Grape::Entity` to preserve compatibility with Grape - [@dblock](https://github.com/dblock).
208
265
 
266
+
209
267
  ### 0.1.0 (2013-01-11)
210
268
 
211
269
  * Initial public release - [@agileanimal](https://github.com/agileanimal).
data/Gemfile CHANGED
@@ -5,16 +5,16 @@ source 'http://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
- gem 'rubocop', '~> 0.51', require: false
8
+ gem 'rubocop', '~> 1.0', require: false
9
9
  end
10
10
 
11
11
  group :test do
12
- gem 'coveralls', require: false
12
+ gem 'coveralls_reborn', require: false
13
13
  gem 'growl'
14
14
  gem 'guard'
15
15
  gem 'guard-bundler'
16
16
  gem 'guard-rspec'
17
17
  gem 'rb-fsevent'
18
- gem 'ruby-grape-danger', '~> 0.1.1', require: false
18
+ gem 'ruby-grape-danger', '~> 0.2', require: false
19
19
  gem 'simplecov', require: false
20
20
  end