icalia-sdk-event-notification 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: 230068702422e0ca767aec6200ac497026377ffe206fdc7c8cb6ca254b05ec3f
4
- data.tar.gz: cdad3744bf89775199c8eacc357d8a9cf54204090d8337a33e3a68eee803ad30
3
+ metadata.gz: '0881a916a5b40c805d4c76fb40d420a0503623a10c89a79b0ad4d7b40bf788cb'
4
+ data.tar.gz: c577623065c6c3b9ce0ad4a75a87343d5126729a51cf8e1ae2830ad1f68caa71
5
5
  SHA512:
6
- metadata.gz: 3a5f5853f12d889fd5b54b38f93feab2ba2ffe382575a9dc9cdfee2a514eaeb5376e6d20463039afca86bca78ab65854dfddeb3b7e9cb25add4d4e92b440a4f1
7
- data.tar.gz: 68b9fdc095c33f3096c4169f4d7862907d0304e509364a603f54f45785d507abf0dc4e4162c5313fa0eda41b0db4c7937e499bbcc89ac6059315910c5d1158da
6
+ metadata.gz: 40f24ef0826ecbbe9d40320b3c32f697d61430aeb13ad3da0d99e3d1fd4fa2eea88bee35d92f9d2988193e861b5620c9bb70371ac04d159004284c449ce77d77
7
+ data.tar.gz: 81bbe1d743b14b4d21291fc395a24538563fbdd97cf10c63616f321492e1b5088485e3c05e5f703b4c20469499915228e6137d21dd3ec64bb70c5381870f6a7f
@@ -9,6 +9,9 @@ module Icalia::Event::Shoryuken
9
9
 
10
10
  delegate :logger, to: Shoryuken
11
11
 
12
+ # By default, process all notifications:
13
+ def process_notification?(notification); true; end
14
+
12
15
  def perform(_sqs_msg, raw_notification)
13
16
  notification = Icalia::Event::Notification.new raw_notification
14
17
 
@@ -23,10 +26,7 @@ module Icalia::Event::Shoryuken
23
26
  send "process_#{action_name.underscore}".to_sym, notification
24
27
  end
25
28
 
26
- delegate :process_notification,
27
- :process_notification?,
28
- :define_noop_action_processor,
29
- to: :class
29
+ delegate :define_noop_action_processor, to: :class
30
30
 
31
31
  class ActionProcessorPatternTest
32
32
  attr_reader :action_name
@@ -40,26 +40,24 @@ module Icalia::Event::Shoryuken
40
40
  def match?; @action_name != nil; end
41
41
  end
42
42
 
43
- class << self
44
- def method_missing(method_sym, *arguments, &block)
45
- processor_test = ActionProcessorPatternTest.new(method_sym)
46
- if processor_test.match?
47
- define_noop_action_processor(method_sym, processor_test.action_name)
48
- send(method_sym, *arguments)
49
- else
50
- super
51
- end
52
- end
53
-
54
- def define_noop_action_processor(action_processor_method, action_name)
55
- define_singleton_method action_processor_method do |*args|
56
- logger.info "#{name} does not know how to process #{action_name}" \
57
- " - Ignoring message"
58
- end
59
- delegate action_processor_method, to: :class
43
+ def method_missing(method_sym, *arguments, &block)
44
+ processor_test = ActionProcessorPatternTest.new(method_sym)
45
+
46
+ if processor_test.match?
47
+ define_noop_action_processor(method_sym, processor_test.action_name)
48
+ return send(method_sym, *arguments)
60
49
  end
61
50
 
62
- def process_data?(data); true; end
51
+ super
52
+ end
53
+
54
+ def self.define_noop_action_processor(action_processor_method, action_name)
55
+ return if method_defined? action_processor_method
56
+
57
+ define_method action_processor_method do |*args|
58
+ logger.info "#{self.class.name} does not know how to process " \
59
+ "#{action_name} - Ignoring message"
60
+ end
63
61
  end
64
62
  end
65
63
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icalia
4
4
  module Event
5
- NOTIFICATION_VERSION = '0.1.5'
5
+ NOTIFICATION_VERSION = '0.1.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalia-sdk-event-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.5
19
+ version: 0.1.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.5
26
+ version: 0.1.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement