esirb 0.2.1 → 0.3.0
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/lib/esirb/client.rb +12 -10
- data/lib/esirb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd136bcdbc33d25122ff858ed5716db09e0ff34b3e262b09fda35f78df150b62
|
|
4
|
+
data.tar.gz: 86cdf99e1f56c391805baabebd655f3a098e3a86b751ef2b21dc44807d2abd22
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0724b07f4fbaf5091e5b7ac7102e56ce714e51052a339a727bf65679ead59702d93c91392d60baddc9dfd2190d2afefecccd20320f1f89df076a52a506f0f2d4
|
|
7
|
+
data.tar.gz: 49d3ea1c34e4124cdd46efb0b174ef954375d0386c1ee8779932cc3b604a08f8f99bd275599ec594fd52306c679ce862345e157947236e26bab21a4a6b9fb1f6
|
data/lib/esirb/client.rb
CHANGED
|
@@ -13,31 +13,33 @@ module Esirb
|
|
|
13
13
|
"If-None-Match" => "",
|
|
14
14
|
"X-Tenant" => "tranquility",
|
|
15
15
|
"X-Compatibility-Date" => "2026-06-09"
|
|
16
|
-
}
|
|
16
|
+
}.freeze
|
|
17
17
|
|
|
18
|
-
attr_reader :token, :path, :tenant, :language, :cache, :cache_store
|
|
18
|
+
attr_reader :token, :path, :tenant, :language, :cache, :cache_store, :raise_errors
|
|
19
19
|
|
|
20
|
-
def initialize(token: nil, tenant: "tranquility", language: "en", cache: true, cache_store: nil)
|
|
20
|
+
def initialize(token: nil, tenant: "tranquility", language: "en", cache: true, cache_store: nil, raise_errors: true)
|
|
21
21
|
@token = token
|
|
22
22
|
@tenant = tenant
|
|
23
23
|
@language = language
|
|
24
24
|
@cache = cache
|
|
25
25
|
@cache_store = cache_store
|
|
26
|
+
@raise_errors = raise_errors
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def connection
|
|
29
30
|
@connection ||= Faraday.new(BASE_URL) do |c|
|
|
30
|
-
c.request :authorization, "Bearer", token if token
|
|
31
|
-
|
|
32
31
|
if cache
|
|
33
|
-
c.use :http_cache,
|
|
34
|
-
store: cache_store,
|
|
35
|
-
strategy: Faraday::HttpCache::Strategies::ByUrl,
|
|
36
|
-
serializer: Marshal
|
|
32
|
+
c.use :http_cache, store: cache_store, strategy: Faraday::HttpCache::Strategies::ByUrl, serializer: Marshal
|
|
37
33
|
end
|
|
38
34
|
|
|
39
|
-
c.request :json
|
|
40
35
|
c.headers = DEFAULT_HEADERS
|
|
36
|
+
c.headers["X-Tenant"] = tenant if tenant
|
|
37
|
+
c.headers["Accept-Language"] = language if language
|
|
38
|
+
|
|
39
|
+
c.request :authorization, "Bearer", token if token
|
|
40
|
+
c.request :json
|
|
41
|
+
|
|
42
|
+
c.response :raise_error if raise_errors
|
|
41
43
|
c.response :json, content_type: "application/json"
|
|
42
44
|
end
|
|
43
45
|
end
|
data/lib/esirb/version.rb
CHANGED