jsonapi_compliable 0.3.4

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 (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +5 -0
  6. data/Appraisals +7 -0
  7. data/CODE_OF_CONDUCT.md +49 -0
  8. data/Gemfile +13 -0
  9. data/Guardfile +32 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +20 -0
  12. data/Rakefile +6 -0
  13. data/bin/appraisal +17 -0
  14. data/bin/console +14 -0
  15. data/bin/rspec +17 -0
  16. data/bin/setup +8 -0
  17. data/gemfiles/rails_3.gemfile +9 -0
  18. data/gemfiles/rails_4.gemfile +16 -0
  19. data/gemfiles/rails_4.gemfile.lock +217 -0
  20. data/gemfiles/rails_5.gemfile +16 -0
  21. data/gemfiles/rails_5.gemfile.lock +222 -0
  22. data/jsonapi_compliable.gemspec +33 -0
  23. data/lib/jsonapi_compliable.rb +30 -0
  24. data/lib/jsonapi_compliable/base.rb +105 -0
  25. data/lib/jsonapi_compliable/deserializable.rb +122 -0
  26. data/lib/jsonapi_compliable/dsl.rb +60 -0
  27. data/lib/jsonapi_compliable/errors.rb +15 -0
  28. data/lib/jsonapi_compliable/scope/base.rb +40 -0
  29. data/lib/jsonapi_compliable/scope/default_filter.rb +25 -0
  30. data/lib/jsonapi_compliable/scope/extra_fields.rb +35 -0
  31. data/lib/jsonapi_compliable/scope/filter.rb +32 -0
  32. data/lib/jsonapi_compliable/scope/filterable.rb +23 -0
  33. data/lib/jsonapi_compliable/scope/paginate.rb +40 -0
  34. data/lib/jsonapi_compliable/scope/sideload.rb +25 -0
  35. data/lib/jsonapi_compliable/scope/sort.rb +29 -0
  36. data/lib/jsonapi_compliable/util/field_params.rb +17 -0
  37. data/lib/jsonapi_compliable/util/include_params.rb +28 -0
  38. data/lib/jsonapi_compliable/util/scoping.rb +20 -0
  39. data/lib/jsonapi_compliable/version.rb +3 -0
  40. metadata +258 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b52f0151a3e5bd49e1535e48c771e3d84ce0e337
4
+ data.tar.gz: a3cf216f224ca0cacb1c8a7b140d8f50ce3df0bb
5
+ SHA512:
6
+ metadata.gz: edbeb7b9bee9b952a6a67d3d237db09af6616dbfb9c38657ded6408ec88192d526a6ecef935923b4d5b02ad2952232e46e8767cef52968dc4ccbed132e34a952
7
+ data.tar.gz: 4f5b5ba91264378f9cd37d29bb832ac4bf3a91bfcd124f13e5949c49a71d06288bf7dc5f7e5736a30c17a43b04c7e84f3efae903797a4445a272051d18ba2c96
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .byebug_history
11
+ spec/dummy/log/*
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.0
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "rails-4" do
2
+ gem "rails", "~> 4.1"
3
+ end
4
+
5
+ appraise "rails-5" do
6
+ gem "rails", "~> 5.0"
7
+ end
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at spasupuleti4@bloomberg.net. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://artprod.dev.bloomberg.com/artifactory/api/gems/rubygems/"
2
+
3
+ # Specify your gem's dependencies in jsonapi_compliable.gemspec
4
+ gemspec
5
+ gem 'active_model_serializers', git: 'https://github.com/richmolj/active_model_serializers.git'
6
+
7
+ group :test do
8
+ gem 'appraisal'
9
+ gem 'guard'
10
+ gem 'guard-rspec'
11
+ gem 'pry'
12
+ gem 'pry-byebug'
13
+ end
data/Guardfile ADDED
@@ -0,0 +1,32 @@
1
+ guard :rspec, cmd: "bundle exec rspec --color --format documentation" do
2
+ require "guard/rspec/dsl"
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+ watch(%r{^spec/(.*)\/?(.*)_spec\.rb$})
5
+
6
+ # Feel free to open issues for suggestions and improvements
7
+
8
+ # RSpec files
9
+ rspec = dsl.rspec
10
+ watch(rspec.spec_helper) { rspec.spec_dir }
11
+ watch(rspec.spec_support) { rspec.spec_dir }
12
+ watch(rspec.spec_files)
13
+
14
+ # Ruby files
15
+ ruby = dsl.ruby
16
+ dsl.watch_spec_files_for(ruby.lib_files)
17
+
18
+ # Rails files
19
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
20
+
21
+ watch(rails.controllers) do |m|
22
+ [
23
+ rspec.spec.call("controllers/#{m[1]}_controller"),
24
+ rspec.spec.call("api/#{m[1]}")
25
+ ]
26
+ end
27
+
28
+ # Rails config changes
29
+ watch(rails.spec_helper) { rspec.spec_dir }
30
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
31
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
32
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Venkata Pasupuleti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ ### JsonapiCompliable
2
+
3
+ [official documentation](https://bbgithub.dev.bloomberg.com/pages/InfrastructureExperience/jsonapi_compliable)
4
+
5
+ Supported Rails versions: >= 4.1
6
+
7
+ ### Running tests
8
+
9
+ We support Rails >= 4.1. To do so, we use the [appraisal](https://github.com/thoughtbot/appraisal) gem. So, run:
10
+
11
+ ```bash
12
+ $ bin/appraisal rails-4 bin/rspec
13
+ $ bin/appraisal rails-5 bin/rspec
14
+ ```
15
+
16
+ Or run tests for all versions:
17
+
18
+ ```bash
19
+ $ bin/appraisal bin/rspec
20
+ ```
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/appraisal ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'appraisal' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("appraisal", "appraisal")
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jsonapi_compliable"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/rspec ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rspec' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://artprod.dev.bloomberg.com/artifactory/api/gems/rubygems/"
4
+
5
+ gem "appraisal"
6
+ gem "active_model_serializers", :git => "https://github.com/richmolj/active_model_serializers.git"
7
+ gem "rails", "~> 3.2"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://artprod.dev.bloomberg.com/artifactory/api/gems/rubygems/"
4
+
5
+ gem "active_model_serializers", :git => "https://github.com/richmolj/active_model_serializers.git"
6
+ gem "rails", "~> 4.1"
7
+
8
+ group :test do
9
+ gem "appraisal"
10
+ gem "guard"
11
+ gem "guard-rspec"
12
+ gem "pry"
13
+ gem "pry-byebug"
14
+ end
15
+
16
+ gemspec :path => "../"
@@ -0,0 +1,217 @@
1
+ GIT
2
+ remote: https://github.com/richmolj/active_model_serializers.git
3
+ revision: 1dc2b74059731339f4df3e7882fd949e20433013
4
+ specs:
5
+ active_model_serializers (0.10.2)
6
+ actionpack (>= 4.1, < 6)
7
+ activemodel (>= 4.1, < 6)
8
+ jsonapi (~> 0.1.1.beta2)
9
+ railties (>= 4.1, < 6)
10
+
11
+ PATH
12
+ remote: ../
13
+ specs:
14
+ jsonapi_compliable (0.3.2)
15
+ active_model_serializers (~> 0.10)
16
+ jsonapi (~> 0.1.1.beta2)
17
+ jsonapi_ams_extensions (~> 0.1)
18
+ rails (>= 4.1, < 6)
19
+
20
+ GEM
21
+ remote: http://artprod.dev.bloomberg.com/artifactory/api/gems/rubygems/
22
+ specs:
23
+ actionmailer (4.2.7.1)
24
+ actionpack (= 4.2.7.1)
25
+ actionview (= 4.2.7.1)
26
+ activejob (= 4.2.7.1)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ actionpack (4.2.7.1)
30
+ actionview (= 4.2.7.1)
31
+ activesupport (= 4.2.7.1)
32
+ rack (~> 1.6)
33
+ rack-test (~> 0.6.2)
34
+ rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
36
+ actionview (4.2.7.1)
37
+ activesupport (= 4.2.7.1)
38
+ builder (~> 3.1)
39
+ erubis (~> 2.7.0)
40
+ rails-dom-testing (~> 1.0, >= 1.0.5)
41
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
42
+ activejob (4.2.7.1)
43
+ activesupport (= 4.2.7.1)
44
+ globalid (>= 0.3.0)
45
+ activemodel (4.2.7.1)
46
+ activesupport (= 4.2.7.1)
47
+ builder (~> 3.1)
48
+ activerecord (4.2.7.1)
49
+ activemodel (= 4.2.7.1)
50
+ activesupport (= 4.2.7.1)
51
+ arel (~> 6.0)
52
+ activesupport (4.2.7.1)
53
+ i18n (~> 0.7)
54
+ json (~> 1.7, >= 1.7.7)
55
+ minitest (~> 5.1)
56
+ thread_safe (~> 0.3, >= 0.3.4)
57
+ tzinfo (~> 1.1)
58
+ appraisal (2.1.0)
59
+ bundler
60
+ rake
61
+ thor (>= 0.14.0)
62
+ arel (6.0.3)
63
+ builder (3.2.2)
64
+ byebug (9.0.5)
65
+ coderay (1.1.1)
66
+ concurrent-ruby (1.0.2)
67
+ database_cleaner (1.5.3)
68
+ diff-lcs (1.2.5)
69
+ erubis (2.7.0)
70
+ ffi (1.9.14)
71
+ formatador (0.2.5)
72
+ globalid (0.3.7)
73
+ activesupport (>= 4.1.0)
74
+ guard (2.14.0)
75
+ formatador (>= 0.2.4)
76
+ listen (>= 2.7, < 4.0)
77
+ lumberjack (~> 1.0)
78
+ nenv (~> 0.1)
79
+ notiffany (~> 0.0)
80
+ pry (>= 0.9.12)
81
+ shellany (~> 0.0)
82
+ thor (>= 0.18.1)
83
+ guard-compat (1.2.1)
84
+ guard-rspec (4.7.3)
85
+ guard (~> 2.1)
86
+ guard-compat (~> 1.1)
87
+ rspec (>= 2.99.0, < 4.0)
88
+ i18n (0.7.0)
89
+ json (1.8.3)
90
+ jsonapi (0.1.1.beta2)
91
+ json (~> 1.8)
92
+ jsonapi_ams_extensions (0.1.0)
93
+ active_model_serializers (~> 0.10.x)
94
+ jsonapi_spec_helpers (0.2.0)
95
+ kaminari (0.17.0)
96
+ actionpack (>= 3.0.0)
97
+ activesupport (>= 3.0.0)
98
+ listen (3.1.5)
99
+ rb-fsevent (~> 0.9, >= 0.9.4)
100
+ rb-inotify (~> 0.9, >= 0.9.7)
101
+ ruby_dep (~> 1.2)
102
+ loofah (2.0.3)
103
+ nokogiri (>= 1.5.9)
104
+ lumberjack (1.0.10)
105
+ mail (2.6.4)
106
+ mime-types (>= 1.16, < 4)
107
+ method_source (0.8.2)
108
+ mime-types (3.1)
109
+ mime-types-data (~> 3.2015)
110
+ mime-types-data (3.2016.0521)
111
+ mini_portile2 (2.1.0)
112
+ minitest (5.9.0)
113
+ nenv (0.3.0)
114
+ nokogiri (1.6.8)
115
+ mini_portile2 (~> 2.1.0)
116
+ pkg-config (~> 1.1.7)
117
+ notiffany (0.1.1)
118
+ nenv (~> 0.1)
119
+ shellany (~> 0.0)
120
+ pkg-config (1.1.7)
121
+ pry (0.10.4)
122
+ coderay (~> 1.1.0)
123
+ method_source (~> 0.8.1)
124
+ slop (~> 3.4)
125
+ pry-byebug (3.4.0)
126
+ byebug (~> 9.0)
127
+ pry (~> 0.10)
128
+ rack (1.6.4)
129
+ rack-test (0.6.3)
130
+ rack (>= 1.0)
131
+ rails (4.2.7.1)
132
+ actionmailer (= 4.2.7.1)
133
+ actionpack (= 4.2.7.1)
134
+ actionview (= 4.2.7.1)
135
+ activejob (= 4.2.7.1)
136
+ activemodel (= 4.2.7.1)
137
+ activerecord (= 4.2.7.1)
138
+ activesupport (= 4.2.7.1)
139
+ bundler (>= 1.3.0, < 2.0)
140
+ railties (= 4.2.7.1)
141
+ sprockets-rails
142
+ rails-deprecated_sanitizer (1.0.3)
143
+ activesupport (>= 4.2.0.alpha)
144
+ rails-dom-testing (1.0.7)
145
+ activesupport (>= 4.2.0.beta, < 5.0)
146
+ nokogiri (~> 1.6.0)
147
+ rails-deprecated_sanitizer (>= 1.0.1)
148
+ rails-html-sanitizer (1.0.3)
149
+ loofah (~> 2.0)
150
+ railties (4.2.7.1)
151
+ actionpack (= 4.2.7.1)
152
+ activesupport (= 4.2.7.1)
153
+ rake (>= 0.8.7)
154
+ thor (>= 0.18.1, < 2.0)
155
+ rake (10.5.0)
156
+ rb-fsevent (0.9.7)
157
+ rb-inotify (0.9.7)
158
+ ffi (>= 0.5.0)
159
+ rspec (3.5.0)
160
+ rspec-core (~> 3.5.0)
161
+ rspec-expectations (~> 3.5.0)
162
+ rspec-mocks (~> 3.5.0)
163
+ rspec-core (3.5.3)
164
+ rspec-support (~> 3.5.0)
165
+ rspec-expectations (3.5.0)
166
+ diff-lcs (>= 1.2.0, < 2.0)
167
+ rspec-support (~> 3.5.0)
168
+ rspec-mocks (3.5.0)
169
+ diff-lcs (>= 1.2.0, < 2.0)
170
+ rspec-support (~> 3.5.0)
171
+ rspec-rails (3.5.2)
172
+ actionpack (>= 3.0)
173
+ activesupport (>= 3.0)
174
+ railties (>= 3.0)
175
+ rspec-core (~> 3.5.0)
176
+ rspec-expectations (~> 3.5.0)
177
+ rspec-mocks (~> 3.5.0)
178
+ rspec-support (~> 3.5.0)
179
+ rspec-support (3.5.0)
180
+ ruby_dep (1.4.0)
181
+ shellany (0.0.1)
182
+ slop (3.6.0)
183
+ sprockets (3.7.0)
184
+ concurrent-ruby (~> 1.0)
185
+ rack (> 1, < 3)
186
+ sprockets-rails (3.2.0)
187
+ actionpack (>= 4.0)
188
+ activesupport (>= 4.0)
189
+ sprockets (>= 3.0.0)
190
+ sqlite3 (1.3.11)
191
+ thor (0.19.1)
192
+ thread_safe (0.3.5)
193
+ tzinfo (1.2.2)
194
+ thread_safe (~> 0.1)
195
+
196
+ PLATFORMS
197
+ ruby
198
+
199
+ DEPENDENCIES
200
+ active_model_serializers!
201
+ appraisal
202
+ bundler (~> 1.12)
203
+ database_cleaner
204
+ guard
205
+ guard-rspec
206
+ jsonapi_compliable!
207
+ jsonapi_spec_helpers
208
+ kaminari
209
+ pry
210
+ pry-byebug
211
+ rails (~> 4.1)
212
+ rake (~> 10.0)
213
+ rspec-rails
214
+ sqlite3
215
+
216
+ BUNDLED WITH
217
+ 1.12.5