files.com 1.1.249 → 1.1.251

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: 9c8a8fbeaf6eb6b2dba5c4e2e68b51ab04b2baee133313e41875b27f49a59116
4
- data.tar.gz: 279bde364ccccc3d154593586776399866a7b19dfb2981ee37daa807ca62a080
3
+ metadata.gz: 4b733d02ecab977884bb8d1952cc0199b1e21b8fbcc767778551dca7678f37d3
4
+ data.tar.gz: 8c3ceb7f3eef2d3e31dd5db09a4ac479226801adab539b8c6b4126548ba7a9b0
5
5
  SHA512:
6
- metadata.gz: 0c031988b53cd7aa7e53379c860c8b491147b6a62ef779187dde555c2f19c9ca158e95a98efd05c86f9c8fb75d32c21b912efc2035e2115841bc69227091bcac
7
- data.tar.gz: 149fe93180d342471a59d58236e06e803e70d73725dc756e7a00615b7b189f6cc8503af9b82c90c372cac48496b7dfd83f51bc536edaa4d73a1def1f9dbe1eca
6
+ metadata.gz: fd1baea799fa57ca10cff6eeb38d51d9d0d1f51fe3cb715729ccdb8f37fe56fec80919e6e0af9fff9744e846cf389edf1583b19a6afd73288f98fe9dbe0eee0d
7
+ data.tar.gz: 610359ee0ab11d8cafae8e7eade71cfdc45e86436c21f22aa2a65f31ac3e595f889f08ddcbb585d8a0a94778d40e91ae1e796cf3fc1201f7920b8f6fa51dbede
data/README.md CHANGED
@@ -330,14 +330,20 @@ end
330
330
 
331
331
  ## Foreign Language Support
332
332
 
333
- The Files.com Ruby SDK will soon be updated to support localized responses by using a configuration
334
- method. When available, it can be used to guide the API in selecting a preferred language for applicable response content.
333
+ The Files.com Ruby SDK supports localized responses by using the `Files.language` configuration attribute.
334
+ When configured, this guides the API in selecting a preferred language for applicable response content.
335
335
 
336
336
  Language support currently applies to select human-facing fields only, such as notification messages
337
337
  and error descriptions.
338
338
 
339
339
  If the specified language is not supported or the value is omitted, the API defaults to English.
340
340
 
341
+ ```shell title="Example Request"
342
+ require 'files.com'
343
+
344
+ Files.language = 'es'
345
+ ```
346
+
341
347
  ## Errors
342
348
 
343
349
  The Files.com Ruby SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.249
1
+ 1.1.251
@@ -332,6 +332,7 @@ module Files
332
332
 
333
333
  headers["X-FilesAPI-Key"] = api_key if api_key
334
334
  headers["X-FilesAPI-Auth"] = session_id if session_id
335
+ headers["Accept-Language"] = Files.language if Files.language
335
336
 
336
337
  user_agent = @system_profiler.user_agent
337
338
  begin
@@ -61,8 +61,8 @@ module Files
61
61
  new(name).each(*args, &block)
62
62
  end
63
63
 
64
- def self.from_path(path)
65
- File.find(path)
64
+ def self.from_path(path, options = {})
65
+ find(path, {}, options)
66
66
  end
67
67
 
68
68
  def self.identical?(path1, path2)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.1.249"
4
+ VERSION = "1.1.251"
5
5
  end
data/lib/files.com.rb CHANGED
@@ -138,6 +138,7 @@ module Files
138
138
  @api_key = nil
139
139
  @app_info = nil
140
140
  @base_url = "https://app.files.com"
141
+ @language = nil
141
142
  @log_level = nil
142
143
  @logger = nil
143
144
  @proxy = nil
@@ -152,7 +153,7 @@ module Files
152
153
  @read_timeout = 60
153
154
 
154
155
  class << self
155
- attr_accessor :api_key, :base_url, :default_headers, :initial_network_retry_delay, :max_network_retry_delay, :open_timeout, :read_timeout, :proxy, :session_id
156
+ attr_accessor :api_key, :base_url, :default_headers, :initial_network_retry_delay, :language, :max_network_retry_delay, :open_timeout, :read_timeout, :proxy, :session_id
156
157
  end
157
158
 
158
159
  # map to the same values as the standard library's logger
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe 'Language setting', :with_test_folder do
4
+ it 'sets the language' do
5
+ # Set language and verify
6
+ Files.language = 'es'
7
+ expect(Files.language).to eq('es')
8
+ begin
9
+ Files::File.find(test_folder.join("read.txt").to_s, {}, options)
10
+ rescue StandardError => e
11
+ expect(e.message).to include('No se ha encontrado')
12
+ end
13
+ end
14
+ end
@@ -97,9 +97,6 @@ RSpec.describe Files::File, :with_test_folder, skip: ENV.fetch("GITLAB", nil) do
97
97
 
98
98
  file = Files::File.find(test_folder.join("with_rename_test.txt").to_s, {}, options)
99
99
  expect(file.read).to eq("I am a string via IO")
100
-
101
- file = Files::File.find(test_folder.join("with_rename_test_1.txt").to_s, {}, options)
102
- expect(file.read).to eq("I am a string via IO")
103
100
  end
104
101
  end
105
102
 
@@ -122,12 +119,12 @@ RSpec.describe Files::File, :with_test_folder, skip: ENV.fetch("GITLAB", nil) do
122
119
  Files::File.open(test_folder.join("read.txt").to_s, 'w', options) do |f|
123
120
  f.write("contents")
124
121
  end
125
- expect(Files::File.from_path(test_folder.join("read.txt").to_s).type).to eq("file")
122
+ expect(Files::File.from_path(test_folder.join("read.txt").to_s, options).type).to eq("file")
126
123
  end
127
124
 
128
125
  it "returns a directory type" do
129
- Files::Folder.mkdir("testdir") unless Files::Folder.exist?("testdir")
130
- expect(Files::File.from_path("testdir").type).to eq("directory")
126
+ Files::Folder.mkdir("testdir", {}, options) unless Files::Folder.exist?("testdir", options)
127
+ expect(Files::File.from_path("testdir", options).type).to eq("directory")
131
128
  end
132
129
  end
133
130
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.249
4
+ version: 1.1.251
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-06 00:00:00.000000000 Z
11
+ date: 2025-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -330,6 +330,7 @@ files:
330
330
  - shared/header_test_data.json
331
331
  - shared/normalization_for_comparison_test_data.json
332
332
  - shared/url_test_data.json
333
+ - spec/language_spec.rb
333
334
  - spec/lib/api_client_spec.rb
334
335
  - spec/list_spec.rb
335
336
  - spec/models/file_spec.rb