rservicebus2 0.2.5 → 0.2.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: c1e12570efafa3e17329ee11b4f458e86ba6d61700dea27f5552e3ef54945cd4
4
- data.tar.gz: 0ad1c7926d644e24f795d6baaacba9b18bbb60c51c6f8d2018b7829c2f02433a
3
+ metadata.gz: 977c2ab9f328770086dc29090e1d06def2037e763e872debc8bcbf9c1050e96c
4
+ data.tar.gz: 0565acd0857455a423c012e6b9f08dc155018c39adf6387642623684adbaaa07
5
5
  SHA512:
6
- metadata.gz: 2db9257198bff90b072fc80f1561e18373b831064f321e3d3238a37904a1026a506276f64d51eb575d21d9d7a5f58d5be4c27246e6e49608b569eb722f7e70fc
7
- data.tar.gz: 88f37e1a0d0837baf786ad2dfaf685f4bce862f62eebeca837275e06d37954a4681f0549b54b6e10757d9cce38a4fc1c99e68c58bb59c88be009584c1c0865cc
6
+ metadata.gz: 596ef0eaed4a2462e324efcda720784bd96fde172975647bd48854c435b97b139029e8e3b5531451cd7e7df2a5a73d9116aa51c19c9bc10ecb55b0a8e9584436
7
+ data.tar.gz: 7fbad671a58644b047341c89f4ab54abf50856a82eadc6bfee121465cea6dbec83f81c59e35f5431c410f2e80ad7aedb9e97537ce35e81172ccf92488720c68b
@@ -17,56 +17,34 @@ module RServiceBus2
17
17
  content
18
18
  end
19
19
 
20
- # rubocop:disable Metrics/MethodLength
21
- def read_content_from_file(file_path)
22
- content = ''
23
- if @input_filter.length > 0
24
- if @input_filter[0] == 'ZIP'
25
- content = read_content_from_zip_file(file_path)
26
- elsif @input_filter[0] == 'GZ'
27
- content = read_content_from_gz_file(file_path)
28
- elsif @input_filter[0] == 'TAR'
29
- fail 'TAR reader not implemented'
30
- end
31
-
32
- else
33
- content = IO.read(file_path)
34
- end
35
-
36
- content
37
- end
38
-
39
20
  def process_path(object_key)
40
21
  # content = read_content_from_object(object_key)
41
- content = object_key
22
+ resp = @s3_client.get_object(bucket: @bucket_name, key: object_key)
23
+
24
+ # call #read or #string on the response body
25
+ content = resp.body.read
42
26
  payload = process_content(content)
43
27
 
44
- send(payload, URI.parse(URI.encode("s3://#{@region}/#{@bucket_name}/#{object_key}")))
28
+ send(payload, URI.parse(CGI.escape("s3://#{@region}/#{@bucket_name}/#{object_key}")))
29
+
30
+ @s3_client.delete_object({ bucket: @bucket_name, key: object_key })
31
+
45
32
  content
46
33
  end
47
34
 
48
35
  def look
49
36
  file_processed = 0
50
- max_files_processed = 1
37
+ max_files_processed = 2
51
38
 
52
- objects = @s3_client.list_objects_v2(
53
- bucket: @bucket_name,
54
- max_keys: max_files_processed
55
- ).contents
56
-
57
- return if objects.count.zero?
39
+ objects = @s3_client.list_objects_v2( bucket: @bucket_name, max_keys: max_files_processed).contents
58
40
 
59
41
  objects.each do |object|
60
42
  RServiceBus2.log "Ready to process, #{object.key}"
61
43
  process_path(object.key)
62
- # content = process_path(object.key)
63
-
64
- # File.unlink(file_path)
65
44
 
66
45
  file_processed += 1
67
46
  RServiceBus2.log "Processed #{file_processed} of #{objects.length}."
68
47
  RServiceBus2.log "Allow system tick #{self.class.name}"
69
- break if file_processed >= max_files_processed
70
48
  end
71
49
  end
72
50
  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.5
4
+ version: 0.2.6
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-04-27 00:00:00.000000000 Z
11
+ date: 2021-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uuidtools