services 6.0.0 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemfiles/rails_4.2.gemfile +1 -1
- data/gemfiles/rails_5.0.gemfile +1 -1
- data/gemfiles/rails_5.1.gemfile +1 -1
- data/lib/services/asyncable.rb +1 -0
- data/lib/services/query.rb +12 -3
- data/lib/services/version.rb +1 -1
- data/services.gemspec +1 -3
- data/spec/services/query_spec.rb +8 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14581b93267e780498f4371c8b3a5810e122d1137f42bc6bed45149f2cc0881f
|
4
|
+
data.tar.gz: 135e7e2cfda92981d940a63fa26c68c092a3560ec5c372aa27c52403b19e0e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f172dfd9a404b678faff6a7652f78a92410f68a4bf1237defa5be719448cf5ea8e2b62efddd6dd2853955fd6fa22a08063ba0d6e19d2c1e49248948597f06fd
|
7
|
+
data.tar.gz: ce9a268f99827c431eab2f05cf12eb72f7d4452766500f16f8d62f274f4ee017daf40bccaa38e8ec652841dafa078a87f39b700afd84d5da4ad816ad2559da74
|
data/gemfiles/rails_4.2.gemfile
CHANGED
data/gemfiles/rails_5.0.gemfile
CHANGED
data/gemfiles/rails_5.1.gemfile
CHANGED
data/lib/services/asyncable.rb
CHANGED
data/lib/services/query.rb
CHANGED
@@ -14,10 +14,19 @@ module Services
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def call(
|
18
|
-
|
17
|
+
def call(ids_or_conditions, _conditions = {})
|
18
|
+
ids, conditions = if ids_or_conditions.is_a?(Hash)
|
19
|
+
if _conditions.any?
|
20
|
+
fail ArgumentError, 'If conditions are passed as first argument, there must not be a second argument.'
|
21
|
+
end
|
22
|
+
[[], ids_or_conditions.symbolize_keys]
|
23
|
+
else
|
24
|
+
if ids_or_conditions.nil?
|
25
|
+
fail ArgumentError, 'IDs must not be nil.'
|
26
|
+
end
|
27
|
+
[Array(ids_or_conditions), _conditions.symbolize_keys]
|
28
|
+
end
|
19
29
|
|
20
|
-
ids, conditions = Array(ids), conditions.symbolize_keys
|
21
30
|
object_table_id = "#{object_class.table_name}.id"
|
22
31
|
|
23
32
|
special_conditions = conditions.extract!(:order, :limit, :page, :per_page)
|
data/lib/services/version.rb
CHANGED
data/services.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
lib = File.expand_path('../lib', __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
|
@@ -24,7 +22,7 @@ Gem::Specification.new do |gem|
|
|
24
22
|
gem.add_development_dependency 'rake', '>= 0.9.0'
|
25
23
|
gem.add_development_dependency 'guard-rspec', '~> 4.2'
|
26
24
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
gem.add_development_dependency 'sidekiq', '~>
|
25
|
+
gem.add_development_dependency 'sidekiq', '~> 5.0'
|
28
26
|
gem.add_development_dependency 'redis', '~> 3.0'
|
29
27
|
gem.add_development_dependency 'redis-namespace', '~> 1.5'
|
30
28
|
gem.add_development_dependency 'tries', '~> 0.3'
|
data/spec/services/query_spec.rb
CHANGED
@@ -22,4 +22,12 @@ describe Services::Query do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
describe 'calling without IDs parameter' do
|
27
|
+
let(:post) { Post.create! title: 'Superpost!' }
|
28
|
+
|
29
|
+
it 'works' do
|
30
|
+
expect(Services::Posts::Find.call title: post.title).to eq([post])
|
31
|
+
end
|
32
|
+
end
|
25
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '5.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '5.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redis
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.7.
|
249
|
+
rubygems_version: 2.7.3
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: A nifty service layer for your Rails app
|