apimatic_core 0.3.13 → 0.3.14

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: 499558cf6c7b083bdec55130a26d5739fb7f52abe1bda62554cb457310a76c7e
4
- data.tar.gz: 3fbeb4ccdcee4b1afd90eb112d02702faff6083fbb84e1c67bd15f9c1108b49e
3
+ metadata.gz: 00e9fe70fd66ace8622a12149e08ae651839bf8c3ab555fd88b48075b63fa3f3
4
+ data.tar.gz: 47b65583f2a0f4badb201965ea172c7683bdba5074e30d737ca2f35a04605b7f
5
5
  SHA512:
6
- metadata.gz: ac93320690da75104215c61fecdd311f7d0addf31c7cd69422a1362affd14319ef43bde2a3fd64f83640a96600105084f5db8c3d64f5099bc6210569d15a2a14
7
- data.tar.gz: e302c98fe4da401715a693423cef2cbc4afaee2f0434be40f711000187557d35392590a9e2653bc941771986ce83ad0d3d2bf4fdeb0159a80f957e064a8ef343
6
+ metadata.gz: 19bf7dbb3489e33e7d9aa84f97fc28a98e9360e9c0a631750844041c46348c9fed64e3060dd33c381fd5eedcc53386a142970c5a821c0d9119f7fbe250d7d93f
7
+ data.tar.gz: 6c93a64bb2fb27f72688fea390a0f97f47729e945d75bf6c2df19f6708f13bd9a832cc4785129edb4310fce6f995012ecc8d80724fc1022f37b80055900f7384
@@ -1,21 +1,27 @@
1
1
  require 'tempfile'
2
2
  require 'open-uri'
3
+
3
4
  module CoreLibrary
4
- # A utility for file specific operations.
5
+ # A utility for file-specific operations.
5
6
  class FileHelper
6
7
  @cache = {}
7
8
 
8
- # Class method which takes a URL, downloads the file (if not already downloaded.
9
- # for this test session) and returns the path of the file.
9
+ # Class method which takes a URL, downloads the file (if not already downloaded
10
+ # for this test session), and returns the file path.
10
11
  # @param [String] url The URL of the required file.
12
+ # @return [String] The path of the downloaded file.
11
13
  def self.get_file(url)
12
- unless @cache.keys.include? url
13
- @cache[url] = Tempfile.new('APIMatic')
14
- @cache[url].binmode
15
- @cache[url].write(URI.parse(url).open({ ssl_ca_cert: Certifi.where }).read)
16
- end
17
- @cache[url].rewind
18
- @cache[url].path
14
+ return @cache[url] if @cache.key?(url)
15
+
16
+ tempfile = Tempfile.new('APIMatic')
17
+ tempfile.binmode
18
+ tempfile.write(URI.parse(url).open(ssl_ca_cert: Certifi.where).read)
19
+ tempfile.flush
20
+ tempfile.close
21
+
22
+ raise 'Tempfile path is nil!' if tempfile.path.nil?
23
+
24
+ @cache[url] = tempfile.path.to_s # Store only the file path
19
25
  end
20
26
  end
21
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
11
+ date: 2025-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces