services 5.1.2 → 6.0.0

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
- SHA1:
3
- metadata.gz: 33dadcc06c08949fdc4e4e93559ff64582eb87a4
4
- data.tar.gz: 3e0c26700eb5ca56247d1c3af47d763b5f5eb69b
2
+ SHA256:
3
+ metadata.gz: 2d1b3541d084340548b9d3779618d88edcf3c10e50ec42c92f1447aa54621a22
4
+ data.tar.gz: fb22582a1c74e144ace44144fb79272d68e0f9f73fadeea69f4ce2947f8bcc10
5
5
  SHA512:
6
- metadata.gz: a48465b9e64aab633b7a302474a7b89d9ab5b49ac328c63c7d63c6b84eae3ead24a4fb0e9b36ea75879641a31ccc8ba766bad15b1ea512673096c0a6df5dde2c
7
- data.tar.gz: 20f7242e49ecee857233982f512f90ea1d39831c20d29128cf42c726ec6d15287a0adc1de8f65901aa1dfb5d17a275e5e88bc53a47cad6b88022c5bc09757d53
6
+ metadata.gz: f62bef4a68d9c9be6b9b9a345f22ee95401cb27c76aaf36a3344af308fbcbc4ba850e670961e0051127624a8e5a1f35eb7d861b695d43cba8c25c284c1bff7c1
7
+ data.tar.gz: af9097b696e781fd46c6456a37277a5e0500b70153759faf438f66813071f550a78b615f2bb90e26fc4098dd17d62d203399e96a443ac1a038951494488221ea
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.2.7
5
- - 2.3.4
6
- - 2.4.1
4
+ - 2.2
5
+ - 2.3
6
+ - 2.4
7
7
  services:
8
8
  - redis-server
9
9
  before_install:
@@ -11,9 +11,6 @@ module Services
11
11
  module Asyncable
12
12
  extend ActiveSupport::Concern
13
13
 
14
- # The name of the parameter that is added to the parameter list when calling a method to be processed in the background.
15
- TARGET_PARAM_NAME = :async_target_id.freeze
16
-
17
14
  ASYNC_METHOD_SUFFIXES = %i(async in at).freeze
18
15
 
19
16
  included do
@@ -21,38 +18,21 @@ module Services
21
18
  end
22
19
 
23
20
  module ClassMethods
24
- # Bulk enqueue items
25
- # args can either be a one-dimensional or two-dimensional array,
26
- # each item in args should be the arguments for one job.
27
- def bulk_call_async(args)
28
- # Convert args to two-dimensional array if it isn't one already.
29
- args = args.map { |arg| [arg] } if args.none? { |arg| arg.is_a?(Array) }
30
- Sidekiq::Client.push_bulk 'class' => self, 'args' => args
31
- end
32
-
33
21
  ASYNC_METHOD_SUFFIXES.each do |async_method_suffix|
34
22
  define_method "call_#{async_method_suffix}" do |*args|
23
+ args.map! do |arg|
24
+ arg.respond_to?(:to_global_id) ? arg.to_global_id : arg
25
+ end
35
26
  self.public_send "perform_#{async_method_suffix}", *args
36
27
  end
37
28
  end
38
29
  end
39
30
 
40
- ASYNC_METHOD_SUFFIXES.each do |async_method_suffix|
41
- define_method "call_#{async_method_suffix}" do |*args|
42
- self.class.public_send "perform_#{async_method_suffix}", *args, TARGET_PARAM_NAME => self.id
43
- end
44
- end
45
-
46
31
  def perform(*args)
47
- return self.call(*args) if self.is_a?(Services::Base)
48
-
49
- target = if args.last.is_a?(Hash) && args.last.keys.first.to_sym == TARGET_PARAM_NAME
50
- self.class.find args.pop.values.first
51
- else
52
- self.class
32
+ args.map! do |arg|
33
+ GlobalID::Locator.locate(arg) || arg
53
34
  end
54
-
55
- target.public_send *args
35
+ call *args
56
36
  end
57
37
  end
58
38
  end
@@ -1,3 +1,3 @@
1
1
  module Services
2
- VERSION = '5.1.2'.freeze
2
+ VERSION = '6.0.0'.freeze
3
3
  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: 5.1.2
4
+ version: 6.0.0
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-01 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -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.6.13
249
+ rubygems_version: 2.7.1
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: A nifty service layer for your Rails app