exporto_api 0.1.0 → 0.1.1
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/CHANGELOG.md +6 -0
- data/README.md +5 -0
- data/lib/exporto_api/auth_client.rb +7 -2
- data/lib/exporto_api/client.rb +9 -2
- data/lib/exporto_api/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 821f56e302f64210c7cb8313dee965d06af56512225da5a268fd190e86b59bb4
|
|
4
|
+
data.tar.gz: e4f7142fbc40c86313db5a0d9c9e366642d1b1f5d2c942b769b5135197e2b9c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 230d3d2a02b644eed19ebbc2e0158ed9cb9b9cc6d3cece4146b109767ed930503a8cbf859f12a539661818f038da89d7d27172824666e8f966daadb7d4d3da73
|
|
7
|
+
data.tar.gz: 7b5f69abbe760e457948032bb7b7d6bc83d5d3fce44f5c8204b031f35389e5692618c1219f6f7feca638814cc1712069900ebf3d29614e14f5eeadf60a42d170
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-09-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Bounded connect and read timeouts on `Client` and `AuthClient` connections (5s / 15s by default), overridable with `open_timeout:` and `timeout:`.
|
|
10
|
+
|
|
5
11
|
## [0.1.0] - 2026-09-02
|
|
6
12
|
|
|
7
13
|
### Added
|
data/README.md
CHANGED
|
@@ -37,6 +37,11 @@ client = ExportoAPI::Client.new(
|
|
|
37
37
|
)
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
Both clients bound every request with a connect and read timeout, defaulting to
|
|
41
|
+
`ExportoAPI::Client::DEFAULT_OPEN_TIMEOUT` (5s) and `ExportoAPI::Client::DEFAULT_TIMEOUT` (15s).
|
|
42
|
+
Pass `open_timeout:` and `timeout:` to either constructor to override them; callers never need to
|
|
43
|
+
reach into the Faraday connection themselves.
|
|
44
|
+
|
|
40
45
|
`AuthClient#token` also accepts an optional space-delimited `scope:` string. Its response exposes `access_token`, `token_type`, `expires_in`, and `scope`.
|
|
41
46
|
|
|
42
47
|
The gem does not cache or refresh tokens. The caller owns token caching by Exporto account, environment, and requested scope, using the returned `expires_in` value and an application-defined safety buffer.
|
|
@@ -4,13 +4,16 @@ require "faraday"
|
|
|
4
4
|
|
|
5
5
|
module ExportoAPI
|
|
6
6
|
class AuthClient
|
|
7
|
-
attr_reader :username, :password, :adapter
|
|
7
|
+
attr_reader :username, :password, :adapter, :open_timeout, :timeout
|
|
8
8
|
|
|
9
|
-
def initialize(username:, password:, sandbox: false, adapter: Faraday.default_adapter
|
|
9
|
+
def initialize(username:, password:, sandbox: false, adapter: Faraday.default_adapter,
|
|
10
|
+
open_timeout: Client::DEFAULT_OPEN_TIMEOUT, timeout: Client::DEFAULT_TIMEOUT)
|
|
10
11
|
@username = username
|
|
11
12
|
@password = password
|
|
12
13
|
@sandbox = sandbox
|
|
13
14
|
@adapter = adapter
|
|
15
|
+
@open_timeout = open_timeout
|
|
16
|
+
@timeout = timeout
|
|
14
17
|
end
|
|
15
18
|
|
|
16
19
|
def token(scope: nil)
|
|
@@ -20,6 +23,8 @@ module ExportoAPI
|
|
|
20
23
|
def connection
|
|
21
24
|
@connection ||= Faraday.new do |connection|
|
|
22
25
|
connection.url_prefix = sandbox? ? Client::TEST_BASE_URL : Client::LIVE_BASE_URL
|
|
26
|
+
connection.options.open_timeout = open_timeout
|
|
27
|
+
connection.options.timeout = timeout
|
|
23
28
|
connection.headers["Accept"] = "application/json"
|
|
24
29
|
connection.request :authorization, :basic, username, password
|
|
25
30
|
connection.request :json
|
data/lib/exporto_api/client.rb
CHANGED
|
@@ -6,13 +6,18 @@ module ExportoAPI
|
|
|
6
6
|
class Client
|
|
7
7
|
LIVE_BASE_URL = "https://api.exporto.de/v1/"
|
|
8
8
|
TEST_BASE_URL = "https://staging.api.exporto.de/v1/"
|
|
9
|
+
DEFAULT_OPEN_TIMEOUT = 5
|
|
10
|
+
DEFAULT_TIMEOUT = 15
|
|
9
11
|
|
|
10
|
-
attr_reader :access_token, :adapter
|
|
12
|
+
attr_reader :access_token, :adapter, :open_timeout, :timeout
|
|
11
13
|
|
|
12
|
-
def initialize(access_token:, sandbox: false, adapter: Faraday.default_adapter
|
|
14
|
+
def initialize(access_token:, sandbox: false, adapter: Faraday.default_adapter,
|
|
15
|
+
open_timeout: DEFAULT_OPEN_TIMEOUT, timeout: DEFAULT_TIMEOUT)
|
|
13
16
|
@access_token = access_token
|
|
14
17
|
@sandbox = sandbox
|
|
15
18
|
@adapter = adapter
|
|
19
|
+
@open_timeout = open_timeout
|
|
20
|
+
@timeout = timeout
|
|
16
21
|
end
|
|
17
22
|
|
|
18
23
|
def label_method
|
|
@@ -26,6 +31,8 @@ module ExportoAPI
|
|
|
26
31
|
def connection
|
|
27
32
|
@connection ||= Faraday.new do |connection|
|
|
28
33
|
connection.url_prefix = sandbox? ? TEST_BASE_URL : LIVE_BASE_URL
|
|
34
|
+
connection.options.open_timeout = open_timeout
|
|
35
|
+
connection.options.timeout = timeout
|
|
29
36
|
connection.headers["Authorization"] = "Bearer #{access_token}"
|
|
30
37
|
connection.headers["Accept"] = "application/json"
|
|
31
38
|
connection.request :json
|
data/lib/exporto_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: exporto_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PostCo
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faraday
|
|
@@ -143,7 +142,6 @@ metadata:
|
|
|
143
142
|
source_code_uri: https://github.com/PostCo/exporto_api
|
|
144
143
|
changelog_uri: https://github.com/PostCo/exporto_api/blob/main/CHANGELOG.md
|
|
145
144
|
rubygems_mfa_required: 'true'
|
|
146
|
-
post_install_message:
|
|
147
145
|
rdoc_options: []
|
|
148
146
|
require_paths:
|
|
149
147
|
- lib
|
|
@@ -158,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
158
156
|
- !ruby/object:Gem::Version
|
|
159
157
|
version: '0'
|
|
160
158
|
requirements: []
|
|
161
|
-
rubygems_version: 3.
|
|
162
|
-
signing_key:
|
|
159
|
+
rubygems_version: 3.6.9
|
|
163
160
|
specification_version: 4
|
|
164
161
|
summary: Rails-independent Ruby client for the Exporto API
|
|
165
162
|
test_files: []
|