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.
- checksums.yaml +5 -5
- data/.coveralls.yml +1 -0
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/ci.yml +41 -0
- data/.gitignore +5 -1
- data/.rspec +2 -1
- data/.rubocop.yml +85 -2
- data/.rubocop_todo.yml +41 -33
- data/CHANGELOG.md +243 -37
- data/CONTRIBUTING.md +1 -1
- data/Dangerfile +3 -0
- data/Gemfile +11 -7
- data/Guardfile +4 -2
- data/LICENSE +1 -1
- data/README.md +272 -19
- data/Rakefile +9 -11
- data/UPGRADING.md +35 -0
- data/bench/serializing.rb +7 -0
- data/grape-entity.gemspec +13 -8
- data/lib/grape-entity.rb +2 -0
- data/lib/grape_entity/condition/base.rb +37 -0
- data/lib/grape_entity/condition/block_condition.rb +23 -0
- data/lib/grape_entity/condition/hash_condition.rb +27 -0
- data/lib/grape_entity/condition/symbol_condition.rb +23 -0
- data/lib/grape_entity/condition.rb +35 -0
- data/lib/grape_entity/delegator/base.rb +7 -0
- data/lib/grape_entity/delegator/fetchable_object.rb +2 -0
- data/lib/grape_entity/delegator/hash_object.rb +4 -2
- data/lib/grape_entity/delegator/openstruct_object.rb +2 -0
- data/lib/grape_entity/delegator/plain_object.rb +2 -0
- data/lib/grape_entity/delegator.rb +14 -9
- data/lib/grape_entity/deprecated.rb +13 -0
- data/lib/grape_entity/entity.rb +192 -258
- data/lib/grape_entity/exposure/base.rb +138 -0
- data/lib/grape_entity/exposure/block_exposure.rb +31 -0
- data/lib/grape_entity/exposure/delegator_exposure.rb +13 -0
- data/lib/grape_entity/exposure/formatter_block_exposure.rb +27 -0
- data/lib/grape_entity/exposure/formatter_exposure.rb +32 -0
- data/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb +83 -0
- data/lib/grape_entity/exposure/nesting_exposure/output_builder.rb +66 -0
- data/lib/grape_entity/exposure/nesting_exposure.rb +133 -0
- data/lib/grape_entity/exposure/represent_exposure.rb +50 -0
- data/lib/grape_entity/exposure.rb +105 -0
- data/lib/grape_entity/options.rb +132 -0
- data/lib/grape_entity/version.rb +3 -1
- data/lib/grape_entity.rb +9 -2
- data/spec/grape_entity/entity_spec.rb +903 -184
- data/spec/grape_entity/exposure/nesting_exposure/nested_exposures_spec.rb +58 -0
- data/spec/grape_entity/exposure/represent_exposure_spec.rb +32 -0
- data/spec/grape_entity/exposure_spec.rb +102 -0
- data/spec/grape_entity/hash_spec.rb +91 -0
- data/spec/grape_entity/options_spec.rb +66 -0
- data/spec/spec_helper.rb +21 -2
- metadata +91 -18
- data/.travis.yml +0 -19
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Grape::Entity::Exposure::NestingExposure::NestedExposures do
|
6
|
+
subject(:nested_exposures) { described_class.new([]) }
|
7
|
+
|
8
|
+
describe '#deep_complex_nesting?(entity)' do
|
9
|
+
it 'is reset when additional exposure is added' do
|
10
|
+
subject << Grape::Entity::Exposure.new(:x, {})
|
11
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
12
|
+
subject.deep_complex_nesting?(subject)
|
13
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to_not be_nil
|
14
|
+
subject << Grape::Entity::Exposure.new(:y, {})
|
15
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'is reset when exposure is deleted' do
|
19
|
+
subject << Grape::Entity::Exposure.new(:x, {})
|
20
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
21
|
+
subject.deep_complex_nesting?(subject)
|
22
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to_not be_nil
|
23
|
+
subject.delete_by(:x)
|
24
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is reset when exposures are cleared' do
|
28
|
+
subject << Grape::Entity::Exposure.new(:x, {})
|
29
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
30
|
+
subject.deep_complex_nesting?(subject)
|
31
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to_not be_nil
|
32
|
+
subject.clear
|
33
|
+
expect(subject.instance_variable_get(:@deep_complex_nesting)).to be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.delete_by' do
|
38
|
+
subject { nested_exposures.delete_by(*attributes) }
|
39
|
+
|
40
|
+
let(:attributes) { [:id] }
|
41
|
+
|
42
|
+
before do
|
43
|
+
nested_exposures << Grape::Entity::Exposure.new(:id, {})
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'deletes matching exposure' do
|
47
|
+
is_expected.to eq []
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when given attribute doesn't exists" do
|
51
|
+
let(:attributes) { [:foo] }
|
52
|
+
|
53
|
+
it 'deletes matching exposure' do
|
54
|
+
is_expected.to eq(nested_exposures)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Grape::Entity::Exposure::RepresentExposure do
|
6
|
+
subject(:exposure) { described_class.new(:foo, {}, {}, double, double) }
|
7
|
+
|
8
|
+
describe '#setup' do
|
9
|
+
subject { exposure.setup(using_class_name, subexposure) }
|
10
|
+
|
11
|
+
let(:using_class_name) { double(:using_class_name) }
|
12
|
+
let(:subexposure) { double(:subexposure) }
|
13
|
+
|
14
|
+
it 'sets using_class_name' do
|
15
|
+
expect { subject }.to change(exposure, :using_class_name).to(using_class_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sets subexposure' do
|
19
|
+
expect { subject }.to change(exposure, :subexposure).to(subexposure)
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when using_class is set' do
|
23
|
+
before do
|
24
|
+
exposure.using_class
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'resets using_class' do
|
28
|
+
expect { subject }.to change(exposure, :using_class)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Grape::Entity::Exposure do
|
6
|
+
let(:fresh_class) { Class.new(Grape::Entity) }
|
7
|
+
let(:model) { double(attributes) }
|
8
|
+
let(:attributes) do
|
9
|
+
{
|
10
|
+
name: 'Bob Bobson',
|
11
|
+
email: 'bob@example.com',
|
12
|
+
birthday: Time.gm(2012, 2, 27),
|
13
|
+
fantasies: ['Unicorns', 'Double Rainbows', 'Nessy'],
|
14
|
+
characteristics: [
|
15
|
+
{ key: 'hair_color', value: 'brown' }
|
16
|
+
],
|
17
|
+
friends: [
|
18
|
+
double(name: 'Friend 1', email: 'friend1@example.com', characteristics: [], fantasies: [], birthday: Time.gm(2012, 2, 27), friends: []),
|
19
|
+
double(name: 'Friend 2', email: 'friend2@example.com', characteristics: [], fantasies: [], birthday: Time.gm(2012, 2, 27), friends: [])
|
20
|
+
]
|
21
|
+
}
|
22
|
+
end
|
23
|
+
let(:entity) { fresh_class.new(model) }
|
24
|
+
subject { fresh_class.find_exposure(:name) }
|
25
|
+
|
26
|
+
describe '#key' do
|
27
|
+
it 'returns the attribute if no :as is set' do
|
28
|
+
fresh_class.expose :name
|
29
|
+
expect(subject.key(entity)).to eq :name
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'returns the :as alias if one exists' do
|
33
|
+
fresh_class.expose :name, as: :nombre
|
34
|
+
expect(subject.key(entity)).to eq :nombre
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'returns the result if :as is a proc' do
|
38
|
+
fresh_class.expose :name, as: proc { object.name.reverse }
|
39
|
+
expect(subject.key(entity)).to eq(model.name.reverse)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns the result if :as is a lambda' do
|
43
|
+
fresh_class.expose :name, as: ->(obj, _opts) { obj.name.reverse }
|
44
|
+
expect(subject.key(entity)).to eq(model.name.reverse)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#conditions_met?' do
|
49
|
+
it 'only passes through hash :if exposure if all attributes match' do
|
50
|
+
fresh_class.expose :name, if: { condition1: true, condition2: true }
|
51
|
+
|
52
|
+
expect(subject.conditions_met?(entity, {})).to be false
|
53
|
+
expect(subject.conditions_met?(entity, condition1: true)).to be false
|
54
|
+
expect(subject.conditions_met?(entity, condition1: true, condition2: true)).to be true
|
55
|
+
expect(subject.conditions_met?(entity, condition1: false, condition2: true)).to be false
|
56
|
+
expect(subject.conditions_met?(entity, condition1: true, condition2: true, other: true)).to be true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'looks for presence/truthiness if a symbol is passed' do
|
60
|
+
fresh_class.expose :name, if: :condition1
|
61
|
+
|
62
|
+
expect(subject.conditions_met?(entity, {})).to be false
|
63
|
+
expect(subject.conditions_met?(entity, condition1: true)).to be true
|
64
|
+
expect(subject.conditions_met?(entity, condition1: false)).to be false
|
65
|
+
expect(subject.conditions_met?(entity, condition1: nil)).to be false
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'looks for absence/falsiness if a symbol is passed' do
|
69
|
+
fresh_class.expose :name, unless: :condition1
|
70
|
+
|
71
|
+
expect(subject.conditions_met?(entity, {})).to be true
|
72
|
+
expect(subject.conditions_met?(entity, condition1: true)).to be false
|
73
|
+
expect(subject.conditions_met?(entity, condition1: false)).to be true
|
74
|
+
expect(subject.conditions_met?(entity, condition1: nil)).to be true
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'only passes through proc :if exposure if it returns truthy value' do
|
78
|
+
fresh_class.expose :name, if: ->(_, opts) { opts[:true] }
|
79
|
+
|
80
|
+
expect(subject.conditions_met?(entity, true: false)).to be false
|
81
|
+
expect(subject.conditions_met?(entity, true: true)).to be true
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'only passes through hash :unless exposure if any attributes do not match' do
|
85
|
+
fresh_class.expose :name, unless: { condition1: true, condition2: true }
|
86
|
+
|
87
|
+
expect(subject.conditions_met?(entity, {})).to be true
|
88
|
+
expect(subject.conditions_met?(entity, condition1: true)).to be true
|
89
|
+
expect(subject.conditions_met?(entity, condition1: true, condition2: true)).to be false
|
90
|
+
expect(subject.conditions_met?(entity, condition1: false, condition2: true)).to be true
|
91
|
+
expect(subject.conditions_met?(entity, condition1: true, condition2: true, other: true)).to be false
|
92
|
+
expect(subject.conditions_met?(entity, condition1: false, condition2: false)).to be true
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'only passes through proc :unless exposure if it returns falsy value' do
|
96
|
+
fresh_class.expose :name, unless: ->(_, opts) { opts[:true] == true }
|
97
|
+
|
98
|
+
expect(subject.conditions_met?(entity, true: false)).to be true
|
99
|
+
expect(subject.conditions_met?(entity, true: true)).to be false
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Grape::Entity do
|
6
|
+
it 'except option for nested entity', :aggregate_failures do
|
7
|
+
module EntitySpec
|
8
|
+
class Address < Grape::Entity
|
9
|
+
expose :post, if: :full
|
10
|
+
expose :city
|
11
|
+
expose :street
|
12
|
+
expose :house
|
13
|
+
end
|
14
|
+
|
15
|
+
class AddressWithString < Grape::Entity
|
16
|
+
self.hash_access = :string
|
17
|
+
expose :post, if: :full
|
18
|
+
expose :city
|
19
|
+
expose :street
|
20
|
+
expose :house, expose_nil: false
|
21
|
+
end
|
22
|
+
|
23
|
+
class Company < Grape::Entity
|
24
|
+
expose :full_name, if: :full
|
25
|
+
expose :name
|
26
|
+
expose :address do |c, o|
|
27
|
+
Address.represent c[:address], Grape::Entity::Options.new(o.opts_hash.except(:full))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class CompanyWithString < Grape::Entity
|
32
|
+
self.hash_access = :string
|
33
|
+
expose :full_name, if: :full
|
34
|
+
expose :name
|
35
|
+
expose :address do |c, o|
|
36
|
+
AddressWithString.represent c['address'], Grape::Entity::Options.new(o.opts_hash.except(:full))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
company = {
|
42
|
+
full_name: 'full_name',
|
43
|
+
name: 'name',
|
44
|
+
address: {
|
45
|
+
post: '123456',
|
46
|
+
city: 'city',
|
47
|
+
street: 'street',
|
48
|
+
house: 'house',
|
49
|
+
something_else: 'something_else'
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
company_with_string = {
|
54
|
+
'full_name' => 'full_name',
|
55
|
+
'name' => 'name',
|
56
|
+
'address' => {
|
57
|
+
'post' => '123456',
|
58
|
+
'city' => 'city',
|
59
|
+
'street' => 'street',
|
60
|
+
'house' => 'house',
|
61
|
+
'something_else' => 'something_else'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
company_without_house_with_string = {
|
66
|
+
'full_name' => 'full_name',
|
67
|
+
'name' => 'name',
|
68
|
+
'address' => {
|
69
|
+
'post' => '123456',
|
70
|
+
'city' => 'city',
|
71
|
+
'street' => 'street',
|
72
|
+
'something_else' => 'something_else'
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
expect(EntitySpec::CompanyWithString.represent(company_with_string).serializable_hash).to eq \
|
77
|
+
company.slice(:name).merge(address: company[:address].slice(:city, :street, :house))
|
78
|
+
|
79
|
+
expect(EntitySpec::CompanyWithString.represent(company_without_house_with_string).serializable_hash).to eq \
|
80
|
+
company.slice(:name).merge(address: company[:address].slice(:city, :street))
|
81
|
+
|
82
|
+
expect(EntitySpec::CompanyWithString.represent(company_with_string, full: true).serializable_hash).to eq \
|
83
|
+
company.slice(:full_name, :name).merge(address: company[:address].slice(:city, :street, :house))
|
84
|
+
|
85
|
+
expect(EntitySpec::Company.represent(company).serializable_hash).to eq \
|
86
|
+
company.slice(:name).merge(address: company[:address].slice(:city, :street, :house))
|
87
|
+
|
88
|
+
expect(EntitySpec::Company.represent(company, full: true).serializable_hash).to eq \
|
89
|
+
company.slice(:full_name, :name).merge(address: company[:address].slice(:city, :street, :house))
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Grape::Entity::Options do
|
6
|
+
module EntitySpec
|
7
|
+
class Crystalline
|
8
|
+
attr_accessor :prop1, :prop2, :prop3
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@prop1 = 'value1'
|
12
|
+
@prop2 = 'value2'
|
13
|
+
@prop3 = 'value3'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class CrystallineEntity < Grape::Entity
|
18
|
+
expose :prop1, if: ->(_, options) { options.fetch(:signal) }
|
19
|
+
expose :prop2, if: ->(_, options) { options.fetch(:beam, 'destructive') == 'destructive' }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context '#fetch' do
|
24
|
+
it 'without passing in a required option raises KeyError' do
|
25
|
+
expect { EntitySpec::CrystallineEntity.represent(EntitySpec::Crystalline.new).as_json }.to raise_error KeyError
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'passing in a required option will expose the values' do
|
29
|
+
crystalline_entity = EntitySpec::CrystallineEntity.represent(EntitySpec::Crystalline.new, signal: true)
|
30
|
+
expect(crystalline_entity.as_json).to eq(prop1: 'value1', prop2: 'value2')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'with an option that is not default will not expose that value' do
|
34
|
+
crystalline_entity = EntitySpec::CrystallineEntity.represent(EntitySpec::Crystalline.new, signal: true, beam: 'intermittent')
|
35
|
+
expect(crystalline_entity.as_json).to eq(prop1: 'value1')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context '#dig', skip: !{}.respond_to?(:dig) do
|
40
|
+
let(:model_class) do
|
41
|
+
Class.new do
|
42
|
+
attr_accessor :prop1
|
43
|
+
|
44
|
+
def initialize
|
45
|
+
@prop1 = 'value1'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:entity_class) do
|
51
|
+
Class.new(Grape::Entity) do
|
52
|
+
expose :prop1, if: ->(_, options) { options.dig(:first, :second) == :nested }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'without passing in a expected option hide the value' do
|
57
|
+
entity = entity_class.represent(model_class.new, first: { invalid: :nested })
|
58
|
+
expect(entity.as_json).to eq({})
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'passing in a expected option will expose the values' do
|
62
|
+
entity = entity_class.represent(model_class.new, first: { second: :nested })
|
63
|
+
expect(entity.as_json).to eq(prop1: 'value1')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
require 'coveralls'
|
5
|
+
|
6
|
+
# This works around the hash extensions not being automatically included in ActiveSupport < 4
|
7
|
+
require 'active_support/version'
|
8
|
+
require 'active_support/core_ext/hash' if ActiveSupport::VERSION &&
|
9
|
+
ActiveSupport::VERSION::MAJOR &&
|
10
|
+
ActiveSupport::VERSION::MAJOR < 4
|
11
|
+
|
12
|
+
# Skip code covarge on Ruby >= 3.1
|
13
|
+
# See https://github.com/simplecov-ruby/simplecov/issues/1003
|
14
|
+
unless RUBY_VERSION >= '3.1'
|
15
|
+
SimpleCov.start do
|
16
|
+
add_filter 'spec/'
|
17
|
+
end
|
18
|
+
|
19
|
+
Coveralls.wear! unless RUBY_PLATFORM.eql? 'java'
|
20
|
+
end
|
21
|
+
|
1
22
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
23
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
24
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support'))
|
@@ -7,6 +28,4 @@ require 'bundler'
|
|
7
28
|
|
8
29
|
Bundler.require :default, :test
|
9
30
|
|
10
|
-
require 'pry'
|
11
|
-
|
12
31
|
RSpec.configure(&:raise_errors_for_deprecations!)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-entity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.3.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -67,7 +67,49 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rack-test
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
@@ -86,16 +128,16 @@ dependencies:
|
|
86
128
|
requirements:
|
87
129
|
- - "~>"
|
88
130
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
131
|
+
version: '3.9'
|
90
132
|
type: :development
|
91
133
|
prerelease: false
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
93
135
|
requirements:
|
94
136
|
- - "~>"
|
95
137
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
138
|
+
version: '3.9'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
140
|
+
name: yard
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
100
142
|
requirements:
|
101
143
|
- - ">="
|
@@ -116,39 +158,65 @@ executables: []
|
|
116
158
|
extensions: []
|
117
159
|
extra_rdoc_files: []
|
118
160
|
files:
|
161
|
+
- ".coveralls.yml"
|
162
|
+
- ".github/dependabot.yml"
|
163
|
+
- ".github/workflows/ci.yml"
|
119
164
|
- ".gitignore"
|
120
165
|
- ".rspec"
|
121
166
|
- ".rubocop.yml"
|
122
167
|
- ".rubocop_todo.yml"
|
123
|
-
- ".travis.yml"
|
124
168
|
- ".yardopts"
|
125
169
|
- CHANGELOG.md
|
126
170
|
- CONTRIBUTING.md
|
171
|
+
- Dangerfile
|
127
172
|
- Gemfile
|
128
173
|
- Guardfile
|
129
174
|
- LICENSE
|
130
175
|
- README.md
|
131
176
|
- RELEASING.md
|
132
177
|
- Rakefile
|
178
|
+
- UPGRADING.md
|
133
179
|
- bench/serializing.rb
|
134
180
|
- grape-entity.gemspec
|
135
181
|
- lib/grape-entity.rb
|
136
182
|
- lib/grape_entity.rb
|
183
|
+
- lib/grape_entity/condition.rb
|
184
|
+
- lib/grape_entity/condition/base.rb
|
185
|
+
- lib/grape_entity/condition/block_condition.rb
|
186
|
+
- lib/grape_entity/condition/hash_condition.rb
|
187
|
+
- lib/grape_entity/condition/symbol_condition.rb
|
137
188
|
- lib/grape_entity/delegator.rb
|
138
189
|
- lib/grape_entity/delegator/base.rb
|
139
190
|
- lib/grape_entity/delegator/fetchable_object.rb
|
140
191
|
- lib/grape_entity/delegator/hash_object.rb
|
141
192
|
- lib/grape_entity/delegator/openstruct_object.rb
|
142
193
|
- lib/grape_entity/delegator/plain_object.rb
|
194
|
+
- lib/grape_entity/deprecated.rb
|
143
195
|
- lib/grape_entity/entity.rb
|
196
|
+
- lib/grape_entity/exposure.rb
|
197
|
+
- lib/grape_entity/exposure/base.rb
|
198
|
+
- lib/grape_entity/exposure/block_exposure.rb
|
199
|
+
- lib/grape_entity/exposure/delegator_exposure.rb
|
200
|
+
- lib/grape_entity/exposure/formatter_block_exposure.rb
|
201
|
+
- lib/grape_entity/exposure/formatter_exposure.rb
|
202
|
+
- lib/grape_entity/exposure/nesting_exposure.rb
|
203
|
+
- lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb
|
204
|
+
- lib/grape_entity/exposure/nesting_exposure/output_builder.rb
|
205
|
+
- lib/grape_entity/exposure/represent_exposure.rb
|
206
|
+
- lib/grape_entity/options.rb
|
144
207
|
- lib/grape_entity/version.rb
|
145
208
|
- spec/grape_entity/entity_spec.rb
|
209
|
+
- spec/grape_entity/exposure/nesting_exposure/nested_exposures_spec.rb
|
210
|
+
- spec/grape_entity/exposure/represent_exposure_spec.rb
|
211
|
+
- spec/grape_entity/exposure_spec.rb
|
212
|
+
- spec/grape_entity/hash_spec.rb
|
213
|
+
- spec/grape_entity/options_spec.rb
|
146
214
|
- spec/spec_helper.rb
|
147
215
|
homepage: https://github.com/ruby-grape/grape-entity
|
148
216
|
licenses:
|
149
217
|
- MIT
|
150
218
|
metadata: {}
|
151
|
-
post_install_message:
|
219
|
+
post_install_message:
|
152
220
|
rdoc_options: []
|
153
221
|
require_paths:
|
154
222
|
- lib
|
@@ -156,17 +224,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
224
|
requirements:
|
157
225
|
- - ">="
|
158
226
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
227
|
+
version: '2.5'
|
160
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
229
|
requirements:
|
162
230
|
- - ">="
|
163
231
|
- !ruby/object:Gem::Version
|
164
232
|
version: '0'
|
165
233
|
requirements: []
|
166
|
-
|
167
|
-
|
168
|
-
signing_key:
|
234
|
+
rubygems_version: 3.3.7
|
235
|
+
signing_key:
|
169
236
|
specification_version: 4
|
170
237
|
summary: A simple facade for managing the relationship between your model and API.
|
171
|
-
test_files:
|
172
|
-
|
238
|
+
test_files:
|
239
|
+
- spec/grape_entity/entity_spec.rb
|
240
|
+
- spec/grape_entity/exposure/nesting_exposure/nested_exposures_spec.rb
|
241
|
+
- spec/grape_entity/exposure/represent_exposure_spec.rb
|
242
|
+
- spec/grape_entity/exposure_spec.rb
|
243
|
+
- spec/grape_entity/hash_spec.rb
|
244
|
+
- spec/grape_entity/options_spec.rb
|
245
|
+
- spec/spec_helper.rb
|
data/.travis.yml
DELETED