grape-entity 0.4.8 → 0.10.2

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.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.coveralls.yml +1 -0
  3. data/.github/dependabot.yml +20 -0
  4. data/.github/workflows/ci.yml +41 -0
  5. data/.gitignore +5 -1
  6. data/.rspec +2 -1
  7. data/.rubocop.yml +85 -2
  8. data/.rubocop_todo.yml +41 -33
  9. data/CHANGELOG.md +243 -37
  10. data/CONTRIBUTING.md +1 -1
  11. data/Dangerfile +3 -0
  12. data/Gemfile +11 -7
  13. data/Guardfile +4 -2
  14. data/LICENSE +1 -1
  15. data/README.md +272 -19
  16. data/Rakefile +9 -11
  17. data/UPGRADING.md +35 -0
  18. data/bench/serializing.rb +7 -0
  19. data/grape-entity.gemspec +13 -8
  20. data/lib/grape-entity.rb +2 -0
  21. data/lib/grape_entity/condition/base.rb +37 -0
  22. data/lib/grape_entity/condition/block_condition.rb +23 -0
  23. data/lib/grape_entity/condition/hash_condition.rb +27 -0
  24. data/lib/grape_entity/condition/symbol_condition.rb +23 -0
  25. data/lib/grape_entity/condition.rb +35 -0
  26. data/lib/grape_entity/delegator/base.rb +7 -0
  27. data/lib/grape_entity/delegator/fetchable_object.rb +2 -0
  28. data/lib/grape_entity/delegator/hash_object.rb +4 -2
  29. data/lib/grape_entity/delegator/openstruct_object.rb +2 -0
  30. data/lib/grape_entity/delegator/plain_object.rb +2 -0
  31. data/lib/grape_entity/delegator.rb +14 -9
  32. data/lib/grape_entity/deprecated.rb +13 -0
  33. data/lib/grape_entity/entity.rb +192 -258
  34. data/lib/grape_entity/exposure/base.rb +138 -0
  35. data/lib/grape_entity/exposure/block_exposure.rb +31 -0
  36. data/lib/grape_entity/exposure/delegator_exposure.rb +13 -0
  37. data/lib/grape_entity/exposure/formatter_block_exposure.rb +27 -0
  38. data/lib/grape_entity/exposure/formatter_exposure.rb +32 -0
  39. data/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb +83 -0
  40. data/lib/grape_entity/exposure/nesting_exposure/output_builder.rb +66 -0
  41. data/lib/grape_entity/exposure/nesting_exposure.rb +133 -0
  42. data/lib/grape_entity/exposure/represent_exposure.rb +50 -0
  43. data/lib/grape_entity/exposure.rb +105 -0
  44. data/lib/grape_entity/options.rb +132 -0
  45. data/lib/grape_entity/version.rb +3 -1
  46. data/lib/grape_entity.rb +9 -2
  47. data/spec/grape_entity/entity_spec.rb +903 -184
  48. data/spec/grape_entity/exposure/nesting_exposure/nested_exposures_spec.rb +58 -0
  49. data/spec/grape_entity/exposure/represent_exposure_spec.rb +32 -0
  50. data/spec/grape_entity/exposure_spec.rb +102 -0
  51. data/spec/grape_entity/hash_spec.rb +91 -0
  52. data/spec/grape_entity/options_spec.rb +66 -0
  53. data/spec/spec_helper.rb +21 -2
  54. metadata +91 -18
  55. data/.travis.yml +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4da3e754b2801be8d8801bf8cc483e457261bee9
4
- data.tar.gz: f5bda0779d4bb3bb76f43f4b6c1207d2b0e8f1d3
2
+ SHA256:
3
+ metadata.gz: 4a89222a95fe66dc86d907762352275aa328a0423a461e2f5a7c8fc806a92f09
4
+ data.tar.gz: a06ad75430e568a7e4cd2e9b6b329011e8382003c5882f690199403be58928c7
5
5
  SHA512:
6
- metadata.gz: 3c12c01509079508b09981d5f4196f489b38be1d23d33f1dd9db9b0e9f2f1f637b83e87e57ad6a2c98ba59cd0a570520960ad4926ba959e895f9a7cffce31f5e
7
- data.tar.gz: 09f153d167e0e0f5e8007d3947660fa9b2723c46a9ca925b257709e6e5209b8d7fca8ef5ede080d8b50b294dfb04a3a5d1bfb7037b97996677dc048c50720440
6
+ metadata.gz: 1bc3419fea51eb0c7c7c78f8f4e510c9d73bfe210cee2aa1f2aaaee92725d02334ab235818a37300c733c0970c9ee40cf56a022b421937ec6662d3e67da3e85f
7
+ data.tar.gz: 4f31cb8e01fbba21883bbf432fa557d0ca7f85d3c1d42a0aac0e4143c4add3af37e7f24b4fc315ff55502a640bffa0d185e8c3081d8a8b5492d45dc1b0102233
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,20 @@
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"
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: weekly
19
+ assignees:
20
+ - "LeFnord"
@@ -0,0 +1,41 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ rubocop:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: '3.1'
22
+ bundler-cache: true
23
+ - name: Run rubocop
24
+ run: bundle exec rubocop --parallel --format progress
25
+
26
+ rspec:
27
+ runs-on: ubuntu-latest
28
+ needs: ['rubocop']
29
+ strategy:
30
+ matrix:
31
+ ruby-version: ['2.7', '3.0', '3.1', 'head', jruby, truffleruby]
32
+ steps:
33
+ - name: Check out branch
34
+ uses: actions/checkout@v3
35
+ - name: Set up Ruby
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby-version }}
39
+ bundler-cache: true
40
+ - name: Run rspec rest of the suite
41
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -31,9 +31,13 @@ pkg
31
31
  dist
32
32
  Gemfile.lock
33
33
  tmp
34
+ coverage/
35
+ .byebug_history
36
+ .ruby-version
37
+ .ruby-gemset
34
38
 
35
39
  ## Rubinius
36
40
  .rbx
37
41
 
38
42
  ## PROJECT::SPECIFIC
39
- .project
43
+ .project
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
- --format=progress
2
+ --profile
3
+ --format documentation
data/.rubocop.yml CHANGED
@@ -1,6 +1,89 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
4
  Exclude:
3
5
  - vendor/**/*
4
- - Guardfile
6
+ - example/**/*
7
+ NewCops: enable
8
+ TargetRubyVersion: 3.1
9
+ SuggestExtensions: false
5
10
 
6
- inherit_from: .rubocop_todo.yml
11
+ # Layout stuff
12
+ #
13
+ Layout/EmptyLinesAroundArguments:
14
+ Enabled: false
15
+
16
+ Layout/EmptyLinesAroundAttributeAccessor:
17
+ Enabled: true
18
+
19
+ Layout/FirstHashElementIndentation:
20
+ EnforcedStyle: consistent
21
+
22
+ Layout/LineLength:
23
+ Max: 120
24
+ Exclude:
25
+ - spec/**/*
26
+
27
+ Layout/SpaceAroundMethodCallOperator:
28
+ Enabled: true
29
+
30
+ # Lint stuff
31
+ #
32
+ Lint/ConstantDefinitionInBlock:
33
+ Enabled: true
34
+ Exclude:
35
+ - spec/**/*
36
+
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/**/*
48
+
49
+ Metrics/CyclomaticComplexity:
50
+ Max: 13
51
+
52
+ Metrics/ClassLength:
53
+ Max: 300
54
+
55
+ Metrics/MethodLength:
56
+ Max: 26
57
+ Exclude:
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'
68
+
69
+ # Naming stuff
70
+ #
71
+
72
+ Naming:
73
+ Enabled: false
74
+
75
+ # Style stuff
76
+ #
77
+ Style/Documentation:
78
+ Enabled: false
79
+
80
+ Style/HashSyntax:
81
+ Enabled: false
82
+
83
+ Style/OptionalBooleanParameter:
84
+ AllowedMethods:
85
+ # from lib/grape_entity/condition/base.rb
86
+ - 'initialize'
87
+ # form lib/grape_entity/entity.rb
88
+ - 'entity_class'
89
+ - 'present_collection'
data/.rubocop_todo.yml CHANGED
@@ -1,42 +1,50 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-08-10 12:30:52 +0300 using RuboCop version 0.31.0.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-07-26 21:29:59 UTC using RuboCop version 1.32.0.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
7
8
 
8
- # Offense count: 7
9
- Metrics/AbcSize:
10
- Max: 45
11
-
12
9
  # Offense count: 1
13
- # Configuration parameters: CountComments.
14
- Metrics/ClassLength:
15
- Max: 333
16
-
17
- # Offense count: 4
18
- Metrics/CyclomaticComplexity:
19
- Max: 17
20
-
21
- # Offense count: 193
22
- # Configuration parameters: AllowURI, URISchemes.
23
- Metrics/LineLength:
24
- Max: 146
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/DeprecatedAttributeAssignment:
14
+ Exclude:
15
+ - 'grape-entity.gemspec'
25
16
 
26
- # Offense count: 8
27
- # Configuration parameters: CountComments.
28
- Metrics/MethodLength:
29
- Max: 26
30
-
31
- # Offense count: 7
32
- Metrics/PerceivedComplexity:
33
- Max: 15
34
-
35
- # Offense count: 37
36
- Style/Documentation:
37
- Enabled: false
17
+ # Offense count: 1
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: Include.
20
+ # Include: **/*.gemspec
21
+ Gemspec/RequireMFA:
22
+ Exclude:
23
+ - 'grape-entity.gemspec'
38
24
 
39
25
  # Offense count: 1
40
- # Configuration parameters: Exclude.
41
- Style/FileName:
42
- Enabled: false
26
+ # Configuration parameters: Include.
27
+ # Include: **/*.gemspec
28
+ Gemspec/RequiredRubyVersion:
29
+ Exclude:
30
+ - 'grape-entity.gemspec'
31
+
32
+ # Offense count: 6
33
+ # This cop supports unsafe autocorrection (--autocorrect-all).
34
+ Lint/BooleanSymbol:
35
+ Exclude:
36
+ - 'spec/grape_entity/exposure_spec.rb'
37
+
38
+ # Offense count: 15
39
+ Style/OpenStructUse:
40
+ Exclude:
41
+ - 'lib/grape_entity/delegator.rb'
42
+ - 'spec/grape_entity/entity_spec.rb'
43
+
44
+ # Offense count: 2
45
+ # This cop supports unsafe autocorrection (--autocorrect-all).
46
+ # Configuration parameters: AllowMethodsWithArguments, IgnoredMethods, AllowComments.
47
+ # IgnoredMethods: respond_to, define_method
48
+ Style/SymbolProc:
49
+ Exclude:
50
+ - 'spec/grape_entity/entity_spec.rb'
data/CHANGELOG.md CHANGED
@@ -1,13 +1,195 @@
1
- 0.4.8 (2015-08-10)
2
- ==================
3
- * [#167](https://github.com/ruby-grape/grape-entity/pull/167): Regression: global settings (exposures, formatters) on `Grape::Entity` should work: [#166](https://github.com/ruby-grape/grape-entity/issues/166) - [@marshall-lee](http://github.com/marshall-lee).
1
+ ### Next
4
2
 
5
- 0.4.7 (2015-08-03)
6
- ==================
7
- * [#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](http://github.com/marshall-lee).
3
+ #### Features
8
4
 
9
- 0.4.6 (2015-07-27)
10
- ==================
5
+ * Your contribution here.
6
+
7
+ #### Fixes
8
+
9
+ * Your contribution here.
10
+
11
+
12
+ ### 0.10.2 (2022-07-29)
13
+
14
+ #### Fixes
15
+
16
+ * [#366](https://github.com/ruby-grape/grape-entity/pull/366): Don't suppress regular ArgumentError exceptions - [splattael](https://github.com/splattael).
17
+ * [#363](https://github.com/ruby-grape/grape-entity/pull/338): Fix typo - [@OuYangJinTing](https://github.com/OuYangJinTing).
18
+ * [#361](https://github.com/ruby-grape/grape-entity/pull/361): Require 'active_support/core_ext' - [@pravi](https://github.com/pravi).
19
+
20
+
21
+ ### 0.10.1 (2021-10-22)
22
+
23
+ #### Fixes
24
+
25
+ * [#359](https://github.com/ruby-grape/grape-entity/pull/359): Respect `hash_access` setting when using `expose_nil: false` option - [@magni-](https://github.com/magni-).
26
+
27
+
28
+ ### 0.10.0 (2021-09-15)
29
+
30
+ #### Features
31
+
32
+ * [#352](https://github.com/ruby-grape/grape-entity/pull/352): Add Default value option - [@ahmednaguib](https://github.com/ahmednaguib).
33
+
34
+ #### Fixes
35
+
36
+ * [#355](https://github.com/ruby-grape/grape-entity/pull/355): Fix infinite loop problem with the `NameErrors` in block exposures - [@meinac](https://github.com/meinac).
37
+
38
+
39
+ ### 0.9.0 (2021-03-20)
40
+
41
+ #### Features
42
+
43
+ * [#346](https://github.com/ruby-grape/grape-entity/pull/346): Ruby 3 support - [@LeFnord](https://github.com/LeFnord).
44
+
45
+
46
+ ### 0.8.2 (2020-11-08)
47
+
48
+ #### Fixes
49
+
50
+ * [#340](https://github.com/ruby-grape/grape-entity/pull/340): Preparations for 3.0 - [@LeFnord](https://github.com/LeFnord).
51
+ * [#338](https://github.com/ruby-grape/grape-entity/pull/338): Fix ruby 2.7 deprecation warning - [@begotten63](https://github.com/begotten63).
52
+
53
+
54
+ ### 0.8.1 (2020-07-15)
55
+
56
+ #### Fixes
57
+
58
+ * [#336](https://github.com/ruby-grape/grape-entity/pull/336): Pass options to delegators when they accept it - [@dnesteryuk](https://github.com/dnesteryuk).
59
+ * [#333](https://github.com/ruby-grape/grape-entity/pull/333): Fix typo in CHANGELOG.md - [@eitoball](https://github.com/eitoball).
60
+
61
+
62
+ ### 0.8.0 (2020-02-18)
63
+
64
+ #### Features
65
+
66
+ * [#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).
67
+ * [#319](https://github.com/ruby-grape/grape-entity/pull/319): Support hashes with string keys - [@mhenrixon](https://github.com/mhenrixon).
68
+ * [#300](https://github.com/ruby-grape/grape-entity/pull/300): Loosens activesupport to 3 - [@ericschultz](https://github.com/ericschultz).
69
+
70
+ #### Fixes
71
+
72
+ * [#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).
73
+ * [#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).
74
+ * [#320](https://github.com/ruby-grape/grape-entity/pull/320): Gemspec: drop eol'd property rubyforge_project - [@olleolleolle](https://github.com/olleolleolle).
75
+ * [#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).
76
+
77
+
78
+ ### 0.7.1 (2018-01-30)
79
+
80
+ #### Features
81
+
82
+ * [#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).
83
+
84
+
85
+ ### 0.7.0 (2018-01-25)
86
+
87
+ #### Features
88
+
89
+ * [#287](https://github.com/ruby-grape/grape-entity/pull/287): Adds ruby 2.5, drops ruby 2.2 support - [@LeFnord](https://github.com/LeFnord).
90
+ * [#277](https://github.com/ruby-grape/grape-entity/pull/277): Provide grape::entity::options#dig - [@kachick](https://github.com/kachick).
91
+ * [#265](https://github.com/ruby-grape/grape-entity/pull/265): Adds ability to provide a proc to as: - [@james2m](https://github.com/james2m).
92
+ * [#264](https://github.com/ruby-grape/grape-entity/pull/264): Adds Rubocop config and todo list - [@james2m](https://github.com/james2m).
93
+ * [#255](https://github.com/ruby-grape/grape-entity/pull/255): Adds code coverage w/ coveralls - [@LeFnord](https://github.com/LeFnord).
94
+ * [#268](https://github.com/ruby-grape/grape-entity/pull/268): Loosens the version dependency for activesupport - [@anakinj](https://github.com/anakinj).
95
+ * [#293](https://github.com/ruby-grape/grape-entity/pull/293): Adds expose_nil option - [@b-boogaard](https://github.com/b-boogaard).
96
+
97
+ #### Fixes
98
+
99
+ * [#288](https://github.com/ruby-grape/grape-entity/pull/288): Fix wrong argument exception when `&:block` passed to the expose method - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
100
+ * [#291](https://github.com/ruby-grape/grape-entity/pull/291): Refactor and simplify various classes and modules - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
101
+ * [#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).
102
+
103
+
104
+ ### 0.6.1 (2017-01-09)
105
+
106
+ #### Features
107
+
108
+ * [#253](https://github.com/ruby-grape/grape-entity/pull/253): Adds ruby 2.4.0 support, updates dependencies - [@LeFnord](https://github.com/LeFnord).
109
+
110
+ #### Fixes
111
+
112
+ * [#251](https://github.com/ruby-grape/grape-entity/pull/251): Avoid noise when code runs with Ruby warnings - [@cpetschnig](https://github.com/cpetschnig).
113
+
114
+
115
+ ### 0.6.0 (2016-11-20)
116
+
117
+ #### Features
118
+
119
+ * [#247](https://github.com/ruby-grape/grape-entity/pull/247): Updates dependencies; refactores to make specs green - [@LeFnord](https://github.com/LeFnord).
120
+
121
+ #### Fixes
122
+
123
+ * [#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).
124
+ * [#248](https://github.com/ruby-grape/grape-entity/pull/248): Fix `nil` values causing errors when `merge` option passed - [@arempe93](https://github.com/arempe93).
125
+
126
+
127
+ ### 0.5.2 (2016-11-14)
128
+
129
+ #### Features
130
+
131
+ * [#226](https://github.com/ruby-grape/grape-entity/pull/226): Added `fetch` from `opts_hash` - [@alanjcfs](https://github.com/alanjcfs).
132
+ * [#232](https://github.com/ruby-grape/grape-entity/pull/232), [#213](https://github.com/ruby-grape/grape-entity/issues/213): Added `#kind_of?` and `#is_a?` to `OutputBuilder` to get an exact class of an `output` object - [@avyy](https://github.com/avyy).
133
+ * [#234](https://github.com/ruby-grape/grape-entity/pull/234), [#233](https://github.com/ruby-grape/grape-entity/issues/233): Added ruby version checking in `Gemfile` to install needed gems versions for supporting old rubies too - [@avyy](https://github.com/avyy).
134
+ * [#237](https://github.com/ruby-grape/grape-entity/pull/237): Added Danger, PR linter - [@dblock](https://github.com/dblock).
135
+
136
+ #### Fixes
137
+
138
+ * [#215](https://github.com/ruby-grape/grape-entity/pull/217): `#delegate_attribute` no longer delegates to methods included with `Kernel` - [@maltoe](https://github.com/maltoe).
139
+ * [#219](https://github.com/ruby-grape/grape-entity/pull/219): Double pass options in `serializable_hash` - [@sbatykov](https://github.com/sbatykov).
140
+ * [#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).
141
+
142
+
143
+ ### 0.5.1 (2016-4-4)
144
+
145
+ #### Features
146
+
147
+ * [#203](https://github.com/ruby-grape/grape-entity/pull/203): `Grape::Entity::Exposure::NestingExposure::NestedExposures.delete_if` always returns exposures - [@rngtng](https://github.com/rngtng).
148
+ * [#204](https://github.com/ruby-grape/grape-entity/pull/204), [#138](https://github.com/ruby-grape/grape-entity/issues/138): Added ability to merge fields into hashes/root (`:merge` option for `.expose`) - [@avyy](https://github.com/avyy).
149
+
150
+ #### Fixes
151
+
152
+ * [#202](https://github.com/ruby-grape/grape-entity/pull/202): Reset `@using_class` memoization on `.setup` - [@rngtng](https://github.com/rngtng).
153
+
154
+
155
+ ### 0.5.0 (2015-12-07)
156
+
157
+ #### Features
158
+
159
+ * [#139](https://github.com/ruby-grape/grape-entity/pull/139): Keep a track of attribute nesting path during condition check or runtime exposure - [@calfzhou](https://github.com/calfzhou).
160
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `.exposures` is removed and substituted with `.root_exposures` array - [@marshall-lee](https://github.com/marshall-lee).
161
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `.nested_exposures` is removed too - [@marshall-lee](https://github.com/marshall-lee).
162
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `#should_return_attribute?`, `#only_fields` and `#except_fields` are moved to other classes - [@marshall-lee](https://github.com/marshall-lee).
163
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Nested `unexpose` now raises an exception: [#152](https://github.com/ruby-grape/grape-entity/issues/152) - [@marshall-lee](https://github.com/marshall-lee).
164
+
165
+ #### Fixes
166
+
167
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Double exposures with conditions does not rewrite previously defined now: [#56](https://github.com/ruby-grape/grape-entity/issues/56) - [@marshall-lee](https://github.com/marshall-lee).
168
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Nested exposures were flattened in `.documentation`: [#112](https://github.com/ruby-grape/grape-entity/issues/112) - [@marshall-lee](https://github.com/marshall-lee).
169
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `@only_fields` and `@except_fields` memoization: [#149](https://github.com/ruby-grape/grape-entity/issues/149) - [@marshall-lee](https://github.com/marshall-lee).
170
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `:unless` condition with `Hash` argument logic: [#150](https://github.com/ruby-grape/grape-entity/issues/150) - [@marshall-lee](https://github.com/marshall-lee).
171
+ * [#151](https://github.com/ruby-grape/grape-entity/pull/151): `@documentation` memoization: [#153](https://github.com/ruby-grape/grape-entity/issues/153) - [@marshall-lee](https://github.com/marshall-lee).
172
+ * [#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).
173
+ * [#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).
174
+
175
+
176
+ ### 0.4.8 (2015-08-10)
177
+
178
+ #### Features
179
+
180
+ * [#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).
181
+
182
+
183
+ ### 0.4.7 (2015-08-03)
184
+
185
+ #### Features
186
+
187
+ * [#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).
188
+
189
+
190
+ ### 0.4.6 (2015-07-27)
191
+
192
+ #### Features
11
193
 
12
194
  * [#114](https://github.com/ruby-grape/grape-entity/pull/114): Added 'only' option that selects which attributes should be returned - [@estevaoam](https://github.com/estevaoam).
13
195
  * [#115](https://github.com/ruby-grape/grape-entity/pull/115): Allowing 'root' to be inherited from parent to child entities - [@guidoprincess](https://github.com/guidoprincess).
@@ -15,46 +197,67 @@
15
197
  * [#134](https://github.com/ruby-grape/grape-entity/pull/134): Subclasses no longer affected in all cases by `unexpose` in parent - [@etehtsea](https://github.com/etehtsea).
16
198
  * [#135](https://github.com/ruby-grape/grape-entity/pull/135): Added `except` option - [@dan-corneanu](https://github.com/dan-corneanu).
17
199
  * [#136](https://github.com/ruby-grape/grape-entity/pull/136): Allow for strings in `only` and `except` options - [@bswinnerton](https://github.com/bswinnerton).
18
- * [#147](https://github.com/ruby-grape/grape-entity/pull/147): Expose `safe` attributes as `nil` if they cannot be evaluated: [#140](https://github.com/ruby-grape/grape-entity/issues/140) - [@marshall-lee](http://github.com/marshall-lee).
19
- * [#147](https://github.com/ruby-grape/grape-entity/pull/147): Fix: private method values were not exposed with `safe` option: [#142](https://github.com/ruby-grape/grape-entity/pull/142) - [@marshall-lee](http://github.com/marshall-lee).
20
- * [#147](https://github.com/ruby-grape/grape-entity/pull/147): Remove catching of `NoMethodError` because it can occur deep inside in a method call so this exception does not mean that attribute not exist - [@marshall-lee](http://github.com/marshall-lee).
21
- * [#147](https://github.com/ruby-grape/grape-entity/pull/147): `valid_exposures` is removed - [@marshall-lee](http://github.com/marshall-lee).
200
+ * [#147](https://github.com/ruby-grape/grape-entity/pull/147), [#140](https://github.com/ruby-grape/grape-entity/issues/140): Expose `safe` attributes as `nil` if they cannot be evaluated - [@marshall-lee](https://github.com/marshall-lee).
201
+ * [#147](https://github.com/ruby-grape/grape-entity/pull/147): Remove catching of `NoMethodError` because it can occur deep inside in a method call so this exception does not mean that attribute not exist - [@marshall-lee](https://github.com/marshall-lee).
202
+ * [#147](https://github.com/ruby-grape/grape-entity/pull/147): The `valid_exposures` method was removed - [@marshall-lee](https://github.com/marshall-lee).
203
+
204
+ #### Fixes
205
+
206
+ * [#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).
207
+
208
+
209
+ ### 0.4.5 (2015-03-10)
22
210
 
23
- 0.4.5 (2015-03-10)
24
- ==================
211
+ #### Features
25
212
 
26
213
  * [#109](https://github.com/ruby-grape/grape-entity/pull/109): Added `unexpose` method - [@jonmchan](https://github.com/jonmchan).
27
214
  * [#98](https://github.com/ruby-grape/grape-entity/pull/98): Added nested conditionals - [@zbelzer](https://github.com/zbelzer).
28
215
  * [#105](https://github.com/ruby-grape/grape-entity/pull/105): Specify which attribute is missing in which Entity - [@jhollinger](https://github.com/jhollinger).
29
- * [#111](https://github.com/ruby-grape/grape-entity/pull/111): Fix: allow usage of attributes with name 'key' if `Hash` objects are used - [@croeck](https://github.com/croeck).
30
- * [#110](https://github.com/ruby-grape/grape-entity/pull/110): Fix: safe exposure when using `Hash` models - [@croeck](https://github.com/croeck).
31
- * [#91](https://github.com/ruby-grape/grape-entity/pull/91): Fix: OpenStruct serializing - [@etehtsea](https://github.com/etehtsea).
32
216
 
33
- 0.4.4 (2014-08-17)
34
- ==================
217
+ #### Fixes
218
+
219
+ * [#111](https://github.com/ruby-grape/grape-entity/pull/111): Allow usage of attributes with name 'key' if `Hash` objects are used - [@croeck](https://github.com/croeck).
220
+ * [#110](https://github.com/ruby-grape/grape-entity/pull/110): Safe exposure when using `Hash` models - [@croeck](https://github.com/croeck).
221
+ * [#91](https://github.com/ruby-grape/grape-entity/pull/91): OpenStruct serializing - [@etehtsea](https://github.com/etehtsea).
222
+
223
+
224
+ ### 0.4.4 (2014-08-17)
225
+
226
+ #### Features
35
227
 
36
228
  * [#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).
37
- * [#85](https://guthub.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).
229
+ * [#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).
230
+
231
+
232
+ ### 0.4.3 (2014-06-12)
233
+
234
+ #### Features
38
235
 
39
- 0.4.3 (2014-06-12)
40
- ==================
236
+ * [#76](https://github.com/ruby-grape/grape-entity/pull/76): Improve performance of entity serialization - [@justfalter](https://github.com/justfalter).
41
237
 
42
- * [#77](https://github.com/ruby-grape/grape-entity/pull/77): Fix: compatibility with Rspec 3 - [@justfalter](https://github.com/justfalter).
43
- * [#76](https://github.com/ruby-grape/grape-entity/pull/76): Improve performance of entity serialization - [@justfalter](https://github.com/justfalter)
238
+ #### Fixes
44
239
 
45
- 0.4.2 (2014-04-03)
46
- ==================
240
+ * [#77](https://github.com/ruby-grape/grape-entity/pull/77): Compatibility with Rspec 3 - [@justfalter](https://github.com/justfalter).
241
+
242
+
243
+ ### 0.4.2 (2014-04-03)
244
+
245
+ #### Features
47
246
 
48
247
  * [#60](https://github.com/ruby-grape/grape-entity/issues/59): Performance issues introduced by nested exposures - [@AlexYankee](https://github.com/AlexYankee).
49
248
  * [#60](https://github.com/ruby-grape/grape-entity/issues/57): Nested exposure double-exposes a field - [@AlexYankee](https://github.com/AlexYankee).
50
249
 
51
- 0.4.1 (2014-02-13)
52
- ==================
250
+
251
+ ### 0.4.1 (2014-02-13)
252
+
253
+ #### Fixes
53
254
 
54
255
  * [#54](https://github.com/ruby-grape/grape-entity/issues/54): Fix: undefined method `to_set` - [@aj0strow](https://github.com/aj0strow).
55
256
 
56
- 0.4.0 (2014-01-27)
57
- ==================
257
+
258
+ ### 0.4.0 (2014-01-27)
259
+
260
+ #### Features
58
261
 
59
262
  * Ruby 1.8.x is no longer supported - [@dblock](https://github.com/dblock).
60
263
  * [#36](https://github.com/ruby-grape/grape-entity/pull/36): Enforcing Ruby style guidelines via Rubocop - [@dblock](https://github.com/dblock).
@@ -71,20 +274,23 @@
71
274
  * [#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).
72
275
  * [#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).
73
276
 
74
- 0.3.0 (2013-03-29)
75
- ==================
277
+
278
+ ### 0.3.0 (2013-03-29)
279
+
280
+ #### Features
76
281
 
77
282
  * [#9](https://github.com/ruby-grape/grape-entity/pull/9): Added `with_options` for block-level exposure setting - [@SegFaultAX](https://github.com/SegFaultAX).
78
283
  * The `instance.entity` method now optionally accepts `options` - [@mbleigh](https://github.com/mbleigh).
79
284
  * You can pass symbols to `:if` and `:unless` to simply check for truthiness/falsiness of the specified options key - [@mbleigh](https://github.com/mbleigh).
80
285
 
81
- 0.2.0 (2013-01-11)
82
- ==================
286
+
287
+ ### 0.2.0 (2013-01-11)
288
+
289
+ #### Features
83
290
 
84
291
  * Moved the namespace back to `Grape::Entity` to preserve compatibility with Grape - [@dblock](https://github.com/dblock).
85
292
 
86
- 0.1.0 (2013-01-11)
87
- ==================
88
293
 
89
- * Initial public release - [@agileanimal](https://github.com/agileanimal).
294
+ ### 0.1.0 (2013-01-11)
90
295
 
296
+ * Initial public release - [@agileanimal](https://github.com/agileanimal).
data/CONTRIBUTING.md CHANGED
@@ -78,7 +78,7 @@ git push origin my-feature-branch
78
78
 
79
79
  #### Make a Pull Request
80
80
 
81
- Go to https://github.com/contributor/grape-entity and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
81
+ Go to https://github.com/ruby-grape/grape-entity and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
82
82
 
83
83
  #### Rebase
84
84
 
data/Dangerfile ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ danger.import_dangerfile(gem: 'ruby-grape-danger')
data/Gemfile CHANGED
@@ -1,16 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  group :development, :test do
6
- gem 'pry'
8
+ gem 'rubocop', '~> 1.0', require: false
9
+ end
10
+
11
+ group :test do
12
+ gem 'coveralls_reborn', require: false
13
+ gem 'growl'
7
14
  gem 'guard'
8
- gem 'guard-rspec'
9
15
  gem 'guard-bundler'
16
+ gem 'guard-rspec'
10
17
  gem 'rb-fsevent'
11
- gem 'growl'
12
- gem 'json'
13
- gem 'rspec'
14
- gem 'rack-test', '~> 0.6.2', require: 'rack/test'
15
- gem 'rubocop', '0.31.0'
18
+ gem 'ruby-grape-danger', '~> 0.2', require: false
19
+ gem 'simplecov', require: false
16
20
  end