files.com 1.1.249 → 1.1.250

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: 98805d730e8daca6c153de77617d11faee90e48adec0b25dec18ad78b317df3e
4
+ data.tar.gz: b33bcf640dc80be6556bc619df8335187eb98d79048ee29ed05074c605a2339e
5
5
  SHA512:
6
- metadata.gz: 0c031988b53cd7aa7e53379c860c8b491147b6a62ef779187dde555c2f19c9ca158e95a98efd05c86f9c8fb75d32c21b912efc2035e2115841bc69227091bcac
7
- data.tar.gz: 149fe93180d342471a59d58236e06e803e70d73725dc756e7a00615b7b189f6cc8503af9b82c90c372cac48496b7dfd83f51bc536edaa4d73a1def1f9dbe1eca
6
+ metadata.gz: 58ca2f7dcb116582d7d2e218f87fe182affa718badcbbdf717aea620e47bf932aad051a2f433d34057fd8667703598ae0bc268762f238de57f7ba0c32351df11
7
+ data.tar.gz: d47cede62ff9c887a6d6d20ecbe9a9bf38f0a8c3f695ae4f771070d7d45073aa4cf7be27b793a63496968da37e1db4da05be33da87d48b178d886bf274134b10
data/README.md CHANGED
@@ -338,6 +338,12 @@ 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.250
@@ -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.250"
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,7 +1,7 @@
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.250
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
@@ -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