rservicebus2 0.2.22 → 0.2.26

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: bdf786cee730fd3a1cb0ecb384d566ead93171cfa566b2b23bff09ab4dc75116
4
- data.tar.gz: 4f8d812c2cf83ce2c1c561038d6d7b545afdb4e8ba5db414554fda52e19eb3d0
3
+ metadata.gz: 8590b64121dc0528e931b8bad65291c44b80e92d9cf1702ab33aad06ba0d246d
4
+ data.tar.gz: b737f18b0ab817bdcf0256a67e01a7d1fc19c9564af74b7242d7050fc3655ff3
5
5
  SHA512:
6
- metadata.gz: 3787ed00c7dd8947ae2e1b000f3953afb34ceb8ffce6925f9c97a3d7ce67cf8d10e2e0d7989da8b7abee110a608066a8e1f95acb752665376beb811a0636d519
7
- data.tar.gz: c8f21f22ea7132ecdf43d6a14c681f68071def8e611ab91e1388fa2dbeaf38ad02c2e89ce9ded75551e444ade20eea54d0493f9252fee2dca2e5cab2fd6c3891
6
+ metadata.gz: b0967729a2066a27fb42723246ff6833e885b9fd8224a71f55086bcff6208b54b606465c3b84301b0ae93c1e99a3ab3d8301173724c49a3186adf09a041bae51
7
+ data.tar.gz: 827131189ff39fe240a5077c3ff5ced08253718b966a2ff13200b29b3d144543ddd648ad8fb65f7441853a5f0c13423113f4223f87007a2ddaf5857bc55c415d
@@ -6,9 +6,20 @@ module RServiceBus2
6
6
  # AppResourceAWSDynamoDb
7
7
  class AppResourceAWSDynamoDb < AppResource
8
8
  def connect(uri)
9
- region = uri.host
9
+ host_name = uri.host
10
+ url_port = uri.port.nil? ? '' : ":#{uri.port}"
10
11
 
11
- Aws::DynamoDB::Client.new(region: region)
12
+ region = nil
13
+ unless uri.query.nil?
14
+ parts = CGI.parse(uri.query)
15
+ region = parts['region'][0] unless parts['region'].nil?
16
+ end
17
+
18
+ if region.nil?
19
+ Aws::DynamoDB::Client.new(endpoint: "http://#{host_name}#{url_port}")
20
+ else
21
+ Aws::DynamoDB::Client.new(endpoint: "http://#{host_name}#{url_port}", region: region)
22
+ end
12
23
  end
13
24
 
14
25
  def finished
@@ -6,9 +6,23 @@ module RServiceBus2
6
6
  # AppResourceAWSDynamoDb
7
7
  class AppResourceAWSS3 < AppResource
8
8
  def connect(uri)
9
- region = uri.host
9
+ host_name = uri.host
10
+ url_port = uri.port.nil? ? '' : ":#{uri.port}"
10
11
 
11
- Aws::S3::Client.new(region: region)
12
+ region = nil
13
+ unless uri.query.nil?
14
+ parts = CGI.parse(uri.query)
15
+ region = parts['region'][0] unless parts['region'].nil?
16
+ end
17
+
18
+ if region.nil?
19
+ Aws::S3::Client.new(endpoint: "http://#{host_name}#{url_port}")
20
+ else
21
+ puts "region: #{region}"
22
+ Aws::S3::Client.new(endpoint: "http://#{host_name}#{url_port}", region: region)
23
+ end
24
+
25
+ #Aws::S3::Client.new(region: region)
12
26
  end
13
27
 
14
28
  def finished
@@ -39,6 +39,8 @@ module RServiceBus2
39
39
  end
40
40
 
41
41
  def self.create_anonymous_class(name_for_class)
42
+ Module.const_get(name_for_class)
43
+ rescue NameError
42
44
  new_anonymous_class = Class.new(Object)
43
45
  Object.const_set(name_for_class, new_anonymous_class)
44
46
  Object.const_get(name_for_class).new
@@ -99,6 +99,7 @@ module RServiceBus2
99
99
 
100
100
  def initialize
101
101
  RServiceBus2.rlog "Current directory: #{Dir.pwd}"
102
+ YamlSafeLoader.instance
102
103
  @config = ConfigFromEnv.new
103
104
  .load_host_section
104
105
  .load_contracts
@@ -9,9 +9,21 @@ module RServiceBus2
9
9
  @bucket_name = uri.path
10
10
  @bucket_name[0] = ''
11
11
 
12
- @region = uri.host
12
+ host_name = uri.host
13
+ url_port = uri.port.nil? ? '' : ":#{uri.port}"
14
+
15
+ region = nil
16
+ unless uri.query.nil?
17
+ parts = CGI.parse(uri.query)
18
+ region = parts['region'][0] unless parts['region'].nil?
19
+ end
20
+
21
+ if region.nil?
22
+ @s3_client = Aws::S3::Client.new(endpoint: "http://#{host_name}#{url_port}")
23
+ else
24
+ @s3_client = Aws::S3::Client.new(endpoint: "http://#{host_name}#{url_port}", region: region)
25
+ end
13
26
 
14
- @s3_client = Aws::S3::Client.new(region: @region)
15
27
  @input_filter = []
16
28
  end
17
29
 
@@ -7,27 +7,21 @@ require 'singleton'
7
7
  class YamlSafeLoader
8
8
  include Singleton
9
9
 
10
- DEFAULT_PERMITTED_CLASSES = 'RServiceBus2::Message,Time,UUIDTools::UUID,YamlSafeLoader,' \
10
+ DEFAULT_PERMITTED_CLASSES = 'RServiceBus2::Message,RServiceBus2::ErrorMessage,Time,UUIDTools::UUID,YamlSafeLoader,' \
11
11
  'URI::Generic,URI::RFC3986_Parser,Symbol,Regexp'
12
12
 
13
- def init
14
- return unless @permitted_classes.nil?
15
-
13
+ def initialize
16
14
  string = "#{RServiceBus2.get_value('PERMITTED_CLASSES_BASE', DEFAULT_PERMITTED_CLASSES)}," \
17
15
  "#{RServiceBus2.get_value('PERMITTED_CLASSES', '')}"
18
16
  @permitted_classes = CSV.parse(string)[0].reject { |c| c.to_s.rstrip.empty? }
19
17
  end
20
18
 
21
19
  def add_permitted_class(string)
22
- init
23
-
24
20
  @permitted_classes << string
25
21
  @permitted_classes.uniq!
26
22
  end
27
23
 
28
24
  def load(body)
29
- init
30
-
31
25
  YAML.safe_load(body, permitted_classes: @permitted_classes)
32
26
  end
33
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rservicebus2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
4
+ version: 0.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-01 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: beanstalk-client