domoscio_rails 0.4.35 → 0.4.36
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/domoscio_rails/version.rb +1 -1
- data/lib/domoscio_rails.rb +6 -3
- 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: aa4f51dc5b31a82ee0797ca7e4df6358a52954c14925106b3d294e2233f13803
|
4
|
+
data.tar.gz: b65d17b02172459dfcc620e623d80572eb1590438ae88c43001bb5143137ba52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f36841571393f25a3d0bb9f79820055abbaed246e4d181b0324496eac37aec537cea142a2150f8355d6e59e55386984b5a0cd105fd0b3b3263166270548d01
|
7
|
+
data.tar.gz: 175c6d3deab00ffbc207170b34c3a2b0f35d6383d8507e3bada4bf005ca3b9ca630fb254a083ec014ed483d6e92db0da45aca8ecb7d3fc66d8f3a7fae5f00dd0
|
data/lib/domoscio_rails.rb
CHANGED
@@ -59,7 +59,8 @@ module DomoscioRails
|
|
59
59
|
# Configurable attributes and default values
|
60
60
|
class Configuration
|
61
61
|
attr_accessor :client_id, :client_passphrase, :temp_dir, :version,
|
62
|
-
:root_url, :file_storage, :access_token, :refresh_token
|
62
|
+
:root_url, :file_storage, :access_token, :refresh_token,
|
63
|
+
:auth_type
|
63
64
|
|
64
65
|
def initialize
|
65
66
|
@version = 2
|
@@ -154,7 +155,7 @@ module DomoscioRails
|
|
154
155
|
#
|
155
156
|
def self.send_request(uri, method, params, headers)
|
156
157
|
response = perform_call(uri, method, params, headers)
|
157
|
-
response = retry_call_and_store_tokens(uri, method, params) if %w[401 403].include? response.code
|
158
|
+
response = retry_call_and_store_tokens(uri, method, params) if %w[401 403].include? response.code && DomoscioRails.configuration.auth_type != 'user'
|
158
159
|
response
|
159
160
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNREFUSED, Errno::ECONNRESET,
|
160
161
|
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
@@ -230,12 +231,14 @@ module DomoscioRails
|
|
230
231
|
# If stored token successfully loaded we build the header with them
|
231
232
|
#
|
232
233
|
def self.send_current_tokens(auth_token)
|
233
|
-
{
|
234
|
+
headers = {
|
234
235
|
'user_agent' => DomoscioRails.user_agent.to_s,
|
235
236
|
'AccessToken' => auth_token[:access_token].to_s,
|
236
237
|
'RefreshToken' => auth_token[:refresh_token].to_s,
|
237
238
|
'Content-Type' => 'application/json'
|
238
239
|
}
|
240
|
+
headers.merge!({ 'X-Auth-Type' => DomoscioRails.configuration.auth_type }) if DomoscioRails.configuration.auth_type
|
241
|
+
headers
|
239
242
|
end
|
240
243
|
|
241
244
|
# If we cant find tokens of they are corrupted / expired, then we set headers to request new ones
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domoscio_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoit Praly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|