wolf_core 0.1.90 → 0.1.91

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: 61e3c5707016f1b5f086aa24537b30983085f3ddda874cdeff5f5f4bd1822f33
4
- data.tar.gz: 4c06d5966f9ea21f03150d1dd7f344ed5e5ef2664708e03c434bac01a52261dc
3
+ metadata.gz: a1f413ca280ec6a3b545b09b41aa3c94ac04ca81dd82f1e5247ddabbd7442613
4
+ data.tar.gz: 245bcae482df84beb3e960bab0014c35eb6872622957771ee824ee3712de4953
5
5
  SHA512:
6
- metadata.gz: 95919530e5744fdc57bb295bcb31446a9028e4597397100a9168c2078e72bdc198016f4ccf1cc6e9798e85b854470d85ae24c239976e2bc71d464fe9debb04c4
7
- data.tar.gz: b4dbe236597e8f8ed35541b7176e1a94caf12cab76a30d3e3949ff6298c266fcbf9d8c272fb90af6db910fd3344d9077c2520d8d920800a9a5eb73e25dc2ff96
6
+ metadata.gz: e0b8d80dad981e4b21daf08f84987824ca85af03b0d138666fb2a6dd25008bbe9b810cf35b576c85a1ab33dcbfa8ce875157544e7579489727508cbbaf18a71b
7
+ data.tar.gz: ca9b9cf5361617f6a071bcf720b93fdceea0b1ef2d03b19db5af4c67437765d5ec9e8c64b169ac18cbedf142180c501aca99af7c92b194537ce39987e45f3b4f
@@ -44,5 +44,30 @@ module WolfCore
44
44
 
45
45
  log_object "File Deleting Process Finished! (#{files_to_delete.size} files deleted)"
46
46
  end
47
+
48
+ def encode_file_to_base64_from_url(url)
49
+ uri = URI.parse(url)
50
+ response = Net::HTTP.get_response(uri)
51
+ raise_service_error({ message: 'Failed to download file', url: url }) unless response.is_a?(Net::HTTPSuccess)
52
+
53
+ encoded_file = Base64.strict_encode64(response.body)
54
+
55
+ content_disposition = response['content-disposition']
56
+
57
+ filename = if content_disposition
58
+ match = content_disposition.match(/filename="?([^"]+)"?/)
59
+ match ? match[1] : File.basename(uri.path)
60
+ else
61
+ File.basename(uri.path)
62
+ end
63
+ log_object filename, title: 'filename is'
64
+ return { filename: filename, encoded_file: encoded_file }
65
+ rescue => e
66
+ raise_service_error({
67
+ message: 'Failed to encode file url',
68
+ encode_file_error: { message: e.message, backtrace: e.backtrace },
69
+ url: url,
70
+ })
71
+ end
47
72
  end
48
- end
73
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.90"
4
+ VERSION = "0.1.91"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.90
4
+ version: 0.1.91
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-20 00:00:00.000000000 Z
11
+ date: 2024-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty