startback 0.17.0 → 0.17.2

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: b1dbab303f03f333dee7304eddf982aa1897750d7805b2835d1a5017db53b260
4
- data.tar.gz: 537e0bd6fc9db8fcaaecd4213bfd13ec30bd2d00163a50745e176c13b8e87919
3
+ metadata.gz: 0d2cd78e89f819311eedaa9dc75d71fdfeff685aa2723d16dd50391077be1061
4
+ data.tar.gz: 808cc9194bedab39965ddcd3cc31774470335b264dd938803a5f90233b9fea73
5
5
  SHA512:
6
- metadata.gz: 2dc1e21ab6c1171f48354ca5c06e349be122dcea3519fa0d12f5230b866047f08f65bdb584d125a5e69021858829fd4a26005dda388605674dd2f6a3396820d7
7
- data.tar.gz: c0cb465263223e21a30718235d5953bbb625da0a8d0217f391c281655ed29da38568eaa138c2868a3bfee6b79b5dce4366435620c311405bd4a6322773428dd7
6
+ metadata.gz: dfdb0ec227a477d7f543dbb8e615d3f81c453fe6f4f9dc18fc20212e9d0fe476fc1c481b0e1292ff6202e99ae7e99fe670f82113fa7b64e1fa7323e53ba08436
7
+ data.tar.gz: f5405619b93cb20ef492beeba4b01d857dfc0d6adf77e50ff2517cefef953d57897c4082bf7d46708e85ad9f2048a475833f151dc78fb265f06eae86e0f661bc
@@ -14,9 +14,10 @@ module Startback
14
14
  include Support::OperationRunner
15
15
  include Support::Robustness
16
16
 
17
- def initialize(engine)
17
+ def initialize(engine, type = :all)
18
18
  @engine = engine
19
19
  @context = nil
20
+ @type = type
20
21
  install_listeners
21
22
  end
22
23
  attr_reader :engine
@@ -41,6 +42,8 @@ module Startback
41
42
  #
42
43
  # See Bus#listen
43
44
  def async(exchange, queue)
45
+ return unless async?
46
+
44
47
  bus.async.listen(exchange, queue) do |event_data|
45
48
  event = engine.factor_event(event_data)
46
49
  with_context(event.context).call(event)
@@ -51,6 +54,8 @@ module Startback
51
54
  #
52
55
  # See Bus#listen
53
56
  def sync(exchange, queue)
57
+ return unless sync?
58
+
54
59
  bus.listen(exchange, queue) do |event_data|
55
60
  event = engine.factor_event(event_data)
56
61
  with_context(event.context).call(event)
@@ -79,6 +84,16 @@ module Startback
79
84
  super(op).merge(context: context)
80
85
  end
81
86
 
87
+ private
88
+
89
+ def async?
90
+ @type == :async || @type == :all
91
+ end
92
+
93
+ def sync?
94
+ @type == :sync || @type == :all
95
+ end
96
+
82
97
  end # class Agent
83
98
  end # class Event
84
99
  end # module Starback
@@ -62,13 +62,13 @@ module Startback
62
62
  bus.connect
63
63
  end
64
64
 
65
- def create_agents
65
+ def create_agents(type = :all)
66
66
  return unless parent = self.class.auto_create_agents
67
67
 
68
68
  ObjectSpace
69
69
  .each_object(Class)
70
70
  .select { |klass| klass <= parent }
71
- .each { |klass| klass.new(self) }
71
+ .each { |klass| klass.new(self, type) }
72
72
  end
73
73
 
74
74
  def factor_event(event_data)
@@ -2,7 +2,7 @@ module Startback
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 17
5
- TINY = 0
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -44,6 +44,8 @@ module Startback
44
44
  @loaded_body ||= case ctype = request.content_type
45
45
  when /json/
46
46
  json_body
47
+ when /x-www-form-urlencoded/
48
+ request.params.dup
47
49
  when /multipart\/form-data/
48
50
  file = params[:file]
49
51
  file_body file, Path(file[:filename]).extname
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startback
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-22 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec