icalia-sdk-event-notification 0.1.4 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dc355973e358c49ba088d8c06c850142fb16d42db1ca4c19fc1bc54a3302be0
4
- data.tar.gz: 8f80cd4e4cfcf5e42613acdebbb09b9c222c5a5b9189bc7c1cd09e931be1949c
3
+ metadata.gz: '0881a916a5b40c805d4c76fb40d420a0503623a10c89a79b0ad4d7b40bf788cb'
4
+ data.tar.gz: c577623065c6c3b9ce0ad4a75a87343d5126729a51cf8e1ae2830ad1f68caa71
5
5
  SHA512:
6
- metadata.gz: df0c1b7316fedbb3b409d89c83dd20ef05a0db8b1ca225365d7ad787587c8f55fcaf241e0f3108907c057c6fd89e9ce483f06a9d458a1486e89380d6515f3bc8
7
- data.tar.gz: 65201055eafc6b966bddc212aff12465bb9666443f4ab56b65f0651567b1755ca739ae0d93c0d0af4fa10c235102561230e02f7de126f6483f891cd345528ffe
6
+ metadata.gz: 40f24ef0826ecbbe9d40320b3c32f697d61430aeb13ad3da0d99e3d1fd4fa2eea88bee35d92f9d2988193e861b5620c9bb70371ac04d159004284c449ce77d77
7
+ data.tar.gz: 81bbe1d743b14b4d21291fc395a24538563fbdd97cf10c63616f321492e1b5088485e3c05e5f703b4c20469499915228e6137d21dd3ec64bb70c5381870f6a7f
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'icalia-sdk-event-core'
4
+
3
5
  require 'active_support'
4
6
  require 'active_support/core_ext/object/blank'
5
7
 
@@ -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.4'
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.4
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.4
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.4
26
+ version: 0.1.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement