files.com 1.0.484 → 1.0.486
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 +4 -4
- data/_VERSION +1 -1
- data/docs/email_incoming_message.md +3 -1
- data/lib/files.com/api_client.rb +6 -9
- data/lib/files.com/models/email_incoming_message.rb +5 -0
- data/lib/files.com/version.rb +1 -1
- data/spec/lib/api_client_spec.rb +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 322c6e72224efa5614973b2af891e64fa439ae20abf0c7660b53ff4c2b54055c
|
4
|
+
data.tar.gz: 3e32e5563c2c663634074e5639674fe5b734c4ba8de49829e454cab4ca9c596a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75490c41da14ebe46d5dca8c79653a9b8158dbe14297d3888ac1bde6cca684e36aa8c6be063360f9b05aae2dd8940104bb5efa3a9d23469f7e23a425fc85fe35
|
7
|
+
data.tar.gz: d6546b9dbbc10027955c872401c395f7a722b5528b8c2c4ef214a80c4747fe47b6bedbeae72babed3bc8f34d5296f109dff1574651f058f28090528ebda6aa7b
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.486
|
@@ -11,7 +11,8 @@
|
|
11
11
|
"status": "success",
|
12
12
|
"body": "example",
|
13
13
|
"message": "example",
|
14
|
-
"created_at": "2000-01-01T01:00:00Z"
|
14
|
+
"created_at": "2000-01-01T01:00:00Z",
|
15
|
+
"inbox_title": "Inbox Title"
|
15
16
|
}
|
16
17
|
```
|
17
18
|
|
@@ -23,6 +24,7 @@
|
|
23
24
|
* `body` (string): Body of the email
|
24
25
|
* `message` (string): Message describing the failure
|
25
26
|
* `created_at` (date-time): Message creation date/time
|
27
|
+
* `inbox_title` (string): Title of the Inbox associated with this message
|
26
28
|
|
27
29
|
|
28
30
|
---
|
data/lib/files.com/api_client.rb
CHANGED
@@ -235,13 +235,10 @@ module Files
|
|
235
235
|
end
|
236
236
|
|
237
237
|
case e
|
238
|
-
when Faraday::ClientError
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
handle_network_error(e, error_context, num_retries, base_url)
|
243
|
-
end
|
244
|
-
|
238
|
+
when Faraday::ClientError
|
239
|
+
handle_error_response(e.response, error_context)
|
240
|
+
when Faraday::ServerError
|
241
|
+
handle_network_error(e, error_context, num_retries, base_url)
|
245
242
|
else
|
246
243
|
raise
|
247
244
|
end
|
@@ -302,10 +299,10 @@ module Files
|
|
302
299
|
end
|
303
300
|
end
|
304
301
|
|
305
|
-
private def handle_network_error(error,
|
302
|
+
private def handle_network_error(error, _context, num_retries, base_url = nil)
|
306
303
|
base_url ||= Files.base_url
|
307
304
|
|
308
|
-
Util.log_error("Network error", error_message: error.message
|
305
|
+
Util.log_error("Network error", error_message: error.message)
|
309
306
|
message = "Could not connect to Files.com at URL #{base_url}. Please check your internet connection and try again. If this problem persists, you should check Files.com's service status at https://status.files.com, or contact your primary account representative."
|
310
307
|
message += " Request was retried #{num_retries} times." if num_retries > 0
|
311
308
|
message += "\n\n(Network error: #{error.message})"
|
@@ -49,6 +49,11 @@ module Files
|
|
49
49
|
@attributes[:created_at]
|
50
50
|
end
|
51
51
|
|
52
|
+
# string - Title of the Inbox associated with this message
|
53
|
+
def inbox_title
|
54
|
+
@attributes[:inbox_title]
|
55
|
+
end
|
56
|
+
|
52
57
|
# Parameters:
|
53
58
|
# cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
54
59
|
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
data/lib/files.com/version.rb
CHANGED
data/spec/lib/api_client_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "pry"
|
2
3
|
|
3
4
|
RSpec.describe Files::ApiClient do
|
4
5
|
let(:subject) { described_class.new }
|
@@ -8,22 +9,22 @@ RSpec.describe Files::ApiClient do
|
|
8
9
|
|
9
10
|
shared_examples 'a server error handler' do
|
10
11
|
before do
|
11
|
-
allow(subject).to receive(:log_request).and_raise(Faraday::ServerError.new('', mock_response))
|
12
|
+
allow(subject).to receive(:log_request).and_raise(Faraday::ServerError.new('the server responded with status 502', mock_response))
|
12
13
|
end
|
13
14
|
|
14
|
-
it 'retries with sleeps and raises general api error' do
|
15
|
+
it 'retries with sleeps and raises general api connection error' do
|
15
16
|
expect(subject).to receive(:sleep).with(0.5).ordered
|
16
17
|
expect(subject).to receive(:sleep).with(be_between(0.5, 1)).ordered
|
17
18
|
expect(subject).to receive(:sleep).with(be_between(1, 2)).ordered
|
18
19
|
expect {
|
19
20
|
subject.execute_request_with_rescues(1, context) { 'empty block' }
|
20
|
-
}.to raise_error(Files::
|
21
|
+
}.to raise_error(Files::APIConnectionError, error_message)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
25
|
context 'when response is a valid json' do
|
25
26
|
it_behaves_like 'a server error handler' do
|
26
|
-
let(:error_message) { "
|
27
|
+
let(:error_message) { "Could not connect to Files.com at URL 1. Please check your internet connection and try again. If this problem persists, you should check Files.com's service status at https://status.files.com, or contact your primary account representative. Request was retried 3 times.\n\n(Network error: the server responded with status 502)" }
|
27
28
|
let(:mock_response) { { status: 502, headers: {}, body: { error: error_message }.to_json } }
|
28
29
|
end
|
29
30
|
end
|
@@ -37,7 +38,7 @@ RSpec.describe Files::ApiClient do
|
|
37
38
|
body: "<html><head><title>502 Bad Gateway</title></head><body><center><h1>502 Bad Gateway</h1></center><hr><center>files.com</center></body></html>"
|
38
39
|
}
|
39
40
|
}
|
40
|
-
let(:error_message) { "
|
41
|
+
let(:error_message) { "Could not connect to Files.com at URL 1. Please check your internet connection and try again. If this problem persists, you should check Files.com's service status at https://status.files.com, or contact your primary account representative. Request was retried 3 times.\n\n(Network error: the server responded with status 502)" }
|
41
42
|
end
|
42
43
|
end
|
43
44
|
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.0.
|
4
|
+
version: 1.0.486
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|