wolf_core 1.0.5 → 1.0.7

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: c0e3cc6599cc90e949b7d9ddde2cfa15bc9f63dcbd380ca5e5f2ee4acc8a0756
4
- data.tar.gz: ac1c8315bbf24077e387eef1c6ff0dfc9cf007dc6d98e91c6d677fc99bbe4ff5
3
+ metadata.gz: 71bb7c33daf9a3ad91b39411f9ebc12fcacbf590b555f2a3fbf16df3688cf25e
4
+ data.tar.gz: e8d13609f4a8b23fe35151f344c3fe76e5316b4acf5c6be0835c2aa6e615631c
5
5
  SHA512:
6
- metadata.gz: 74ea58ec0cdeaa230ce9778c5960e445504e7f18f985cb9eca85c0772da1753caeba672f141b800aaf3ecc2a5c59f4acc3192e8710de04ef1a189a6ba6686db6
7
- data.tar.gz: f560892556880ba27792590fee58502125488f15dc98e85719bf2a90179105ff593e38e7af965a50dd53f44645fc14c31147572564345a40317eee6397c1bf2b
6
+ metadata.gz: e2b6649dc83823a05a5b7924b26b9bfee4801fffcdcca6dbdbdbd715d8be766026a43c0e52f569c398ef9c03c78158a52fe30f2e44d818a0077f5c373425fa3e
7
+ data.tar.gz: 45dc1a3c4d3989ee0bfcbd8b6c918638cba95829d97cecc1322499445d58943bce674692b688281a99299f1da823c680edf11158aa706b8aacd65f9397864b31
@@ -30,7 +30,8 @@ module WolfCore
30
30
 
31
31
  def route_event_request(path:, body:)
32
32
  environment = ENV['ENVIRONMENT']
33
- if environment == 'production'
33
+ deployable_envs = ['production', 'staging']
34
+ if deployable_envs.include?(environment)
34
35
  function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
35
36
  raise_service_error("Function name not found for path: #{path}") if function_name.blank?
36
37
 
@@ -7,7 +7,8 @@ module WolfCore
7
7
 
8
8
  def route_event_request(path:, body:)
9
9
  environment = ENV['ENVIRONMENT']
10
- if environment == 'production'
10
+ deployable_envs = ['production', 'staging']
11
+ if deployable_envs.include?(environment)
11
12
  function_name = PATH_TO_FUNCTION_NAME_MAPPING[path]
12
13
  raise_service_error("Function name not found for path: #{path}") if function_name.blank?
13
14
 
@@ -46,11 +46,10 @@ module WolfCore
46
46
  end
47
47
 
48
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)
49
+ response = download_file_from_url(url)
50
+ bytes = response.body
52
51
 
53
- encoded_file = Base64.strict_encode64(response.body)
52
+ encoded_file = Base64.strict_encode64(bytes)
54
53
 
55
54
  content_disposition = response['content-disposition']
56
55
 
@@ -69,5 +68,16 @@ module WolfCore
69
68
  url: url,
70
69
  })
71
70
  end
71
+
72
+ def bytes_from_url(url)
73
+ download_file_from_url(url).body
74
+ end
75
+
76
+ def download_file_from_url(url)
77
+ uri = URI.parse(url)
78
+ response = Net::HTTP.get_response(uri)
79
+ raise_service_error({ message: 'Failed to download file', url: url }) unless response.is_a?(Net::HTTPSuccess)
80
+ response
81
+ end
72
82
  end
73
83
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.7"
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: 1.0.5
4
+ version: 1.0.7
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-10-17 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty