serializer_field_filter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +6 -0
- data/MIT-LICENSE +19 -0
- data/README.md +76 -0
- data/Rakefile +3 -0
- data/lib/serializer_field_filter/all_field.rb +12 -0
- data/lib/serializer_field_filter/none_field.rb +13 -0
- data/lib/serializer_field_filter/relation.rb +37 -0
- data/lib/serializer_field_filter/resource_options.rb +10 -0
- data/lib/serializer_field_filter/version.rb +3 -0
- data/lib/serializer_field_filter.rb +35 -0
- data/serializer_field_filter.gemspec +25 -0
- data/spec/serializer_field_filter/all_field_spec.rb +11 -0
- data/spec/serializer_field_filter/none_field_spec.rb +11 -0
- data/spec/serializer_field_filter/relation_spec.rb +135 -0
- data/spec/serializer_field_filter_spec.rb +50 -0
- data/spec/spec_helper.rb +16 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b0dbf86f5db59c3f5ea4c6745e5ec3e823ad168
|
4
|
+
data.tar.gz: aaaa85edaf7b4f0ec44d2884aaedcfa534b58460
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b042e03ea9805186345d0e85df506104f078e540a8a407e4bb9bcb68c68fe74f3bb50510a2447029b1c72ec0a515ea2e8c9e395b484d2788502bbe4f05f4dc8b
|
7
|
+
data.tar.gz: 0aabe79773c1b83d38ed094c8a0f5d34ab7c009f94856bf79cebe207a257082710d3cb9349117007af1361ba5500f4fdc17a9f3fa02deba38bfebd0616df02f1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2007 David Heinemeier Hansson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
## serializer_field_filter
|
2
|
+
|
3
|
+
field filter for [active_model_serializers](https://github.com/rails-api/active_model_serializers)
|
4
|
+
|
5
|
+
|
6
|
+
### Install
|
7
|
+
|
8
|
+
gem install 'serializer_field_filter'
|
9
|
+
|
10
|
+
### Usage
|
11
|
+
|
12
|
+
```Ruby
|
13
|
+
class BaseSerializer < ActiveModel::Serializer
|
14
|
+
include SerializerFieldFilter::Relation
|
15
|
+
end
|
16
|
+
|
17
|
+
class CourceSerializer < BaseSerializer
|
18
|
+
attributes :id, :name
|
19
|
+
has_one_with_filter :classroom
|
20
|
+
belongs_to_with_filter :teacher
|
21
|
+
has_many_with_filter :students
|
22
|
+
end
|
23
|
+
|
24
|
+
class ClassroomSerializer < BaseSerializer
|
25
|
+
attributes :id, :name
|
26
|
+
end
|
27
|
+
|
28
|
+
class TeacherSerializer < BaseSerializer
|
29
|
+
attributes :id, :name
|
30
|
+
end
|
31
|
+
|
32
|
+
class StudentSerializer < BaseSerializer
|
33
|
+
attributes :id, :name
|
34
|
+
end
|
35
|
+
|
36
|
+
class BaseModel
|
37
|
+
include ActiveModel::Model
|
38
|
+
include ActiveModel::Serialization
|
39
|
+
end
|
40
|
+
|
41
|
+
class Cource < BaseModel
|
42
|
+
attr_accessor :id, :name, :classroom, :teacher, :students
|
43
|
+
end
|
44
|
+
|
45
|
+
class Classroom < BaseModel
|
46
|
+
attr_accessor :id, :name
|
47
|
+
end
|
48
|
+
|
49
|
+
class Teacher < BaseModel
|
50
|
+
attr_accessor :id, :name
|
51
|
+
end
|
52
|
+
|
53
|
+
class Student < BaseModel
|
54
|
+
attr_accessor :id, :name
|
55
|
+
end
|
56
|
+
|
57
|
+
classroom = Classroom.new(id: 1, name: "classroom")
|
58
|
+
teacher = Teacher.new(id: 1, name: "teacher")
|
59
|
+
student_1 = Student.new(id: 1, name: "student")
|
60
|
+
student_2 = Student.new(id: 2, name: "student")
|
61
|
+
cource = Cource.new(id: 1, name: "cource", classroom: classroom, teacher: teacher, students: [student_1, student_2])
|
62
|
+
|
63
|
+
filter = SerializerFieldFilter.init(%w(id name classroom teacher.name students.id))
|
64
|
+
|
65
|
+
json = ActiveModelSerializers::SerializableResource.new(cource, filter.resource_options).as_json
|
66
|
+
# => {
|
67
|
+
# id: 1,
|
68
|
+
# name: 'cource',
|
69
|
+
# classroom: { id: 1, name: 'classroom' },
|
70
|
+
# teacher: { name: 'teacher' },
|
71
|
+
# students: [
|
72
|
+
# { id: 1 },
|
73
|
+
# { id: 2 }
|
74
|
+
# ]
|
75
|
+
# }
|
76
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
class SerializerFieldFilter
|
2
|
+
module Relation
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
[:has_many, :belongs_to, :has_one].each do |relation_method_name|
|
6
|
+
class_eval <<-RUBY
|
7
|
+
def self.#{relation_method_name}_with_filter(resource_name, serializer: nil)
|
8
|
+
attribute resource_name
|
9
|
+
resource_method_module = Module.new do
|
10
|
+
define_method resource_name do
|
11
|
+
filter = instance_options[:field_filter]&.scope_of(resource_name)
|
12
|
+
resource_options = filter.resource_options.merge({
|
13
|
+
serializer: serializer,
|
14
|
+
})
|
15
|
+
resources = defined?(super) ? super() : object.send(resource_name)
|
16
|
+
if "#{relation_method_name}" == "has_many"
|
17
|
+
resources.to_a.map do |resource|
|
18
|
+
serializer_for_resource(resource, resource_options) if resource.present?
|
19
|
+
end
|
20
|
+
else
|
21
|
+
serializer_for_resource(resources, resource_options) if resources.present?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
prepend resource_method_module
|
26
|
+
end
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def serializer_for_resource(resource, resource_options)
|
33
|
+
ActiveModelSerializers::SerializableResource.new(resource, resource_options).as_json
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "active_model_serializers"
|
2
|
+
require "serializer_field_filter/version"
|
3
|
+
require "serializer_field_filter/resource_options"
|
4
|
+
require "serializer_field_filter/all_field"
|
5
|
+
require "serializer_field_filter/none_field"
|
6
|
+
require "serializer_field_filter/relation"
|
7
|
+
|
8
|
+
class SerializerFieldFilter
|
9
|
+
include ResourceOptions
|
10
|
+
|
11
|
+
attr_reader :fields
|
12
|
+
|
13
|
+
def initialize(fields = [])
|
14
|
+
@fields = fields
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.init(fields = nil)
|
18
|
+
fields.present? ? new(fields) : AllField.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def root_fields
|
22
|
+
return if fields.blank?
|
23
|
+
fields.map { |field| field.split('.').first.to_sym }.uniq
|
24
|
+
end
|
25
|
+
|
26
|
+
def scope_of(resource_name)
|
27
|
+
if fields.include?(resource_name.to_s)
|
28
|
+
AllField.new
|
29
|
+
else
|
30
|
+
scope_fields = fields.select { |field| field.start_with?("#{resource_name}.") }
|
31
|
+
.map { |field| field.split('.', 2).last }
|
32
|
+
scope_fields.present? ? SerializerFieldFilter.new(scope_fields) : NoneField.new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'serializer_field_filter/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "serializer_field_filter"
|
7
|
+
spec.version = SerializerFieldFilter::VERSION
|
8
|
+
spec.authors = ["Franky"]
|
9
|
+
spec.email = ["zhanglinjie412@gmail.com"]
|
10
|
+
spec.description = %q{field filter for active_model_serializers}
|
11
|
+
spec.summary = %q{field filter for active_model_serializers}
|
12
|
+
spec.homepage = "https://github.com/zhanglinjie/serializer_field_filter"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler'
|
21
|
+
spec.add_development_dependency 'rails'
|
22
|
+
spec.add_development_dependency 'active_model_serializers'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'simplecov'
|
25
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe SerializerFieldFilter::AllField do
|
3
|
+
subject(:filter) { SerializerFieldFilter::AllField.new }
|
4
|
+
describe '#root_fields' do
|
5
|
+
it { expect(filter.root_fields).to eq(nil) }
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#scope_of' do
|
9
|
+
it { expect(filter.scope_of(:authors)).to be_a SerializerFieldFilter::AllField }
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe SerializerFieldFilter::NoneField do
|
3
|
+
subject(:filter) { SerializerFieldFilter::NoneField.new }
|
4
|
+
describe '#root_fields' do
|
5
|
+
it { expect(filter.root_fields).to eq([]) }
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#scope_of' do
|
9
|
+
it { expect(filter.scope_of(:authors)).to be_a SerializerFieldFilter::NoneField }
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe SerializerFieldFilter::Relation do
|
3
|
+
class BaseSerializer < ActiveModel::Serializer
|
4
|
+
include SerializerFieldFilter::Relation
|
5
|
+
end
|
6
|
+
|
7
|
+
class CourceSerializer < BaseSerializer
|
8
|
+
attributes :id, :name
|
9
|
+
has_one_with_filter :classroom
|
10
|
+
belongs_to_with_filter :teacher
|
11
|
+
has_many_with_filter :students
|
12
|
+
end
|
13
|
+
|
14
|
+
class ClassroomSerializer < BaseSerializer
|
15
|
+
attributes :id, :name
|
16
|
+
end
|
17
|
+
|
18
|
+
class TeacherSerializer < BaseSerializer
|
19
|
+
attributes :id, :name
|
20
|
+
end
|
21
|
+
|
22
|
+
class StudentSerializer < BaseSerializer
|
23
|
+
attributes :id, :name
|
24
|
+
end
|
25
|
+
|
26
|
+
class BaseModel
|
27
|
+
include ActiveModel::Model
|
28
|
+
include ActiveModel::Serialization
|
29
|
+
end
|
30
|
+
|
31
|
+
class Cource < BaseModel
|
32
|
+
attr_accessor :id, :name, :classroom, :teacher, :students
|
33
|
+
end
|
34
|
+
|
35
|
+
class Classroom < BaseModel
|
36
|
+
attr_accessor :id, :name
|
37
|
+
end
|
38
|
+
|
39
|
+
class Teacher < BaseModel
|
40
|
+
attr_accessor :id, :name
|
41
|
+
end
|
42
|
+
|
43
|
+
class Student < BaseModel
|
44
|
+
attr_accessor :id, :name
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:classroom) { Classroom.new(id: 1, name: "classroom") }
|
48
|
+
let(:teacher) { Teacher.new(id: 1, name: "teacher") }
|
49
|
+
let(:student_1) { Student.new(id: 1, name: "student") }
|
50
|
+
let(:student_2) { Student.new(id: 2, name: "student") }
|
51
|
+
let(:cource) { Cource.new(id: 1, name: "cource", classroom: classroom, teacher: teacher, students: [student_1, student_2])}
|
52
|
+
|
53
|
+
subject(:json) {
|
54
|
+
ActiveModelSerializers::SerializableResource.new(cource, filter.resource_options).as_json
|
55
|
+
}
|
56
|
+
|
57
|
+
context "with all field" do
|
58
|
+
let(:filter) { SerializerFieldFilter::AllField.new }
|
59
|
+
it { should eq({
|
60
|
+
id: 1,
|
61
|
+
name: 'cource',
|
62
|
+
classroom: { id: 1, name: 'classroom' },
|
63
|
+
teacher: { id: 1, name: 'teacher' },
|
64
|
+
students: [
|
65
|
+
{ id: 1, name: 'student' },
|
66
|
+
{ id: 2, name: 'student' }
|
67
|
+
]
|
68
|
+
})
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
context "with none field" do
|
73
|
+
let(:filter) { SerializerFieldFilter::NoneField.new }
|
74
|
+
it { should eq({})}
|
75
|
+
end
|
76
|
+
|
77
|
+
context "with root partial field" do
|
78
|
+
let(:filter) { SerializerFieldFilter.init(['id']) }
|
79
|
+
it { should eq({ id: 1 }) }
|
80
|
+
end
|
81
|
+
|
82
|
+
context "with has_one all fields" do
|
83
|
+
let(:filter) { SerializerFieldFilter.init(['classroom']) }
|
84
|
+
it { should eq({
|
85
|
+
classroom: { id: 1, name: 'classroom' }
|
86
|
+
})
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
context "with has_one partial fields" do
|
91
|
+
let(:filter) { SerializerFieldFilter.init(['classroom.id']) }
|
92
|
+
it { should eq({
|
93
|
+
classroom: { id: 1 }
|
94
|
+
})
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
context "with belongs_to all fields" do
|
99
|
+
let(:filter) { SerializerFieldFilter.init(['teacher']) }
|
100
|
+
it { should eq({
|
101
|
+
teacher: { id: 1, name: 'teacher' }
|
102
|
+
})
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
context "with belongs_to partial fields" do
|
107
|
+
let(:filter) { SerializerFieldFilter.init(['teacher.id']) }
|
108
|
+
it { should eq({
|
109
|
+
teacher: { id: 1 }
|
110
|
+
})
|
111
|
+
}
|
112
|
+
end
|
113
|
+
|
114
|
+
context "with has_many all fields" do
|
115
|
+
let(:filter) { SerializerFieldFilter.init(['students']) }
|
116
|
+
it { should eq({
|
117
|
+
students: [
|
118
|
+
{ id: 1, name: 'student' },
|
119
|
+
{ id: 2, name: 'student' }
|
120
|
+
]
|
121
|
+
})
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
context "with has_many partial fields" do
|
126
|
+
let(:filter) { SerializerFieldFilter.init(['students.id']) }
|
127
|
+
it { should eq({
|
128
|
+
students: [
|
129
|
+
{ id: 1 },
|
130
|
+
{ id: 2 }
|
131
|
+
]
|
132
|
+
})
|
133
|
+
}
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
RSpec.describe SerializerFieldFilter do
|
4
|
+
describe "::init" do
|
5
|
+
context "with nil params" do
|
6
|
+
subject { SerializerFieldFilter.init }
|
7
|
+
it { should be_a SerializerFieldFilter::AllField }
|
8
|
+
end
|
9
|
+
|
10
|
+
context "with empty params" do
|
11
|
+
subject { SerializerFieldFilter.init([]) }
|
12
|
+
it { should be_a SerializerFieldFilter::AllField }
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with present params" do
|
16
|
+
subject { SerializerFieldFilter.init(['id', 'name']) }
|
17
|
+
it { should be_a SerializerFieldFilter }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#root_fields" do
|
22
|
+
context "with fields depth 1" do
|
23
|
+
subject { SerializerFieldFilter.init(['id', 'name']).root_fields }
|
24
|
+
it { should eq([:id, :name]) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with fields depth 2" do
|
28
|
+
subject { SerializerFieldFilter.init(['id', 'name', 'authors.id', 'authors.name']).root_fields }
|
29
|
+
it { should eq([:id, :name, :authors]) }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#scope_of' do
|
34
|
+
context "with none fields" do
|
35
|
+
subject { SerializerFieldFilter.init(['id', 'title']).scope_of(:authors) }
|
36
|
+
it { should be_a SerializerFieldFilter::NoneField }
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with all fields" do
|
40
|
+
subject { SerializerFieldFilter.init(['id', 'title', 'authors']).scope_of(:authors) }
|
41
|
+
it { should be_a SerializerFieldFilter::AllField }
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with partial fields" do
|
45
|
+
subject { SerializerFieldFilter.init(['id', 'title', 'authors.id', 'authors.name']).scope_of(:authors) }
|
46
|
+
it { should be_a SerializerFieldFilter }
|
47
|
+
it { expect(subject.root_fields).to eq([:id, :name])}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'byebug'
|
4
|
+
require 'rspec'
|
5
|
+
require 'rails/all'
|
6
|
+
require 'active_model_serializers'
|
7
|
+
|
8
|
+
require 'simplecov'
|
9
|
+
SimpleCov.start
|
10
|
+
|
11
|
+
require 'serializer_field_filter'
|
12
|
+
|
13
|
+
ActiveModelSerializers.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new('/dev/null'))
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serializer_field_filter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Franky
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: active_model_serializers
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
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
|
+
description: field filter for active_model_serializers
|
84
|
+
email:
|
85
|
+
- zhanglinjie412@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- MIT-LICENSE
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/serializer_field_filter.rb
|
96
|
+
- lib/serializer_field_filter/all_field.rb
|
97
|
+
- lib/serializer_field_filter/none_field.rb
|
98
|
+
- lib/serializer_field_filter/relation.rb
|
99
|
+
- lib/serializer_field_filter/resource_options.rb
|
100
|
+
- lib/serializer_field_filter/version.rb
|
101
|
+
- serializer_field_filter.gemspec
|
102
|
+
- spec/serializer_field_filter/all_field_spec.rb
|
103
|
+
- spec/serializer_field_filter/none_field_spec.rb
|
104
|
+
- spec/serializer_field_filter/relation_spec.rb
|
105
|
+
- spec/serializer_field_filter_spec.rb
|
106
|
+
- spec/spec_helper.rb
|
107
|
+
homepage: https://github.com/zhanglinjie/serializer_field_filter
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.5.2
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: field filter for active_model_serializers
|
131
|
+
test_files:
|
132
|
+
- spec/serializer_field_filter/all_field_spec.rb
|
133
|
+
- spec/serializer_field_filter/none_field_spec.rb
|
134
|
+
- spec/serializer_field_filter/relation_spec.rb
|
135
|
+
- spec/serializer_field_filter_spec.rb
|
136
|
+
- spec/spec_helper.rb
|