jsonapi-resources-filterer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cffdd44838f18970cf322474a8b15a84a7988bcd
4
- data.tar.gz: 18bb0a0e912bac3dd663c6c69e720c90e3d7248b
3
+ metadata.gz: 877fc3b98a40562b7aa3b9e6f1f5ebb55baa6392
4
+ data.tar.gz: dc9528a104c951dc07f6c5dda7f69018b56cdd6d
5
5
  SHA512:
6
- metadata.gz: 34de67866b9ad52d1cc3cde48a33e87d4d70db9a5021d096a54bd80a59e109b8577537b3cb4eb2988ba3e6bec90f7a783200f6f2a72c988e77ef2de610d513b5
7
- data.tar.gz: 8e0ffb39315fdb9a99f46ea8d0c586d306be2e999bdfdc5aaa127e3b1f5a38b5aba951eea4fc2d72e7962e99ba0ec0b3f860f0c89d87acdae94a26ffb1f5921b
6
+ metadata.gz: 4155d4256fb7af6460b8288aae5f5b66ae65b9500358b25d5c6a7655153b484c8aa5718c01bd4cc5c5b588971eaf6d0f528a68552d76dbeb8ff2880bd67c69af
7
+ data.tar.gz: 2bbdb00acebf2b65160b69edd7c10cc6c96476ee750787b427ebe4e84ec5394be3eb78e4a007bb1d74703135be4b053f54b7bf3cc50a8ce8018c21f05dfb298e
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # v0.1.1
2
+
3
+ - Define JSONAPI::Resources::Filterer::ClassMethods#apply_filter to use `filterer`
4
+
5
+ # v0.1.0
6
+
7
+ - Initial release
data/README.md CHANGED
@@ -66,6 +66,20 @@ class ContactFilterer < Filterer::Base
66
66
  end
67
67
  ```
68
68
 
69
+ ## Testing
70
+
71
+ ```sh
72
+ # Install gems
73
+ $ bundle install
74
+
75
+ # run specs
76
+ $ bin/rspec spec
77
+ # or
78
+ $ bundle exec rspec spec
79
+ # or
80
+ $ rspec spec # can sometimes be slow if not run in the context of Gemfile
81
+ ```
82
+
69
83
  ## Development
70
84
 
71
85
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
data/bin/rspec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "sqlite3"
37
37
  spec.add_development_dependency "jsonapi-resources-matchers"
38
38
  spec.add_development_dependency "rspec"
39
+ spec.add_development_dependency "database_cleaner", "~> 1.4"
39
40
  end
@@ -34,6 +34,14 @@ module JSONAPI
34
34
  end
35
35
  end
36
36
 
37
+ def apply_filter(records, filter, value, _options = {})
38
+ if self._filterer
39
+ self._filterer.chain({filter => value}, {starting_query: records})
40
+ else
41
+ super(records, filter, value, _options = {})
42
+ end
43
+ end
44
+
37
45
  private
38
46
 
39
47
  def filterer_class_from(module_name, class_name)
@@ -1,7 +1,7 @@
1
1
  module JSONAPI
2
2
  module Resources
3
3
  module Filterer
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources-filterer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - G5
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2015-07-20 00:00:00.000000000 Z
13
+ date: 2015-07-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jsonapi-resources
@@ -124,6 +124,20 @@ dependencies:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: database_cleaner
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '1.4'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '1.4'
127
141
  description: Integration between filterer and jsonapi-resources
128
142
  email:
129
143
  - lateam@getg5.com
@@ -136,12 +150,14 @@ files:
136
150
  - ".gitignore"
137
151
  - ".rspec"
138
152
  - ".travis.yml"
153
+ - CHANGELOG.md
139
154
  - CODE_OF_CONDUCT.md
140
155
  - Gemfile
141
156
  - LICENSE.txt
142
157
  - README.md
143
158
  - Rakefile
144
159
  - bin/console
160
+ - bin/rspec
145
161
  - bin/setup
146
162
  - jsonapi-resources-filterer.gemspec
147
163
  - lib/jsonapi/resources/filterer.rb