distributed-press-api-client 0.2.0 → 0.2.2
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/distributed_press/v1/client.rb +7 -3
- data/lib/distributed_press/version.rb +1 -1
- 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: 7cc2e318b07cdd179bf6a7817f3f35fbf0adb2ec2ea10c3a507b8f565605c469
|
4
|
+
data.tar.gz: 51f43af7ba7cb51de03419f473cd20a3a39f42ff24542f8fb9a346bbbd8dc441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64283cf5dc2a5bb7089917f09de9b43bdccccf748c83be099002b8e9676d065988d64571d4d9f0b599049cee2fe19d8627d7ddf476489a1078caa62c2056ca29
|
7
|
+
data.tar.gz: eb252a94732ac916de5496f8ad74f0c19005a1f15c9c4776105c20f2a53cf61a6ad7d1637fecdbe10efa30a5b9e8898f37288bfbd60a0d6b3d83fe887bae830a
|
@@ -31,8 +31,11 @@ class DistributedPress
|
|
31
31
|
#
|
32
32
|
# @param url [String]
|
33
33
|
# @param token [String,Distributed::Press::V1::Token]
|
34
|
-
|
34
|
+
# @param logger [Logger]
|
35
|
+
def initialize(url: 'https://api.distributed.press', token: nil, logger: nil)
|
35
36
|
self.class.default_options[:base_uri] = @url = HTTParty.normalize_base_uri(url)
|
37
|
+
self.class.default_options[:logger] = logger if logger
|
38
|
+
self.class.default_options[:log_format] = :logstash
|
36
39
|
|
37
40
|
@token =
|
38
41
|
case token
|
@@ -73,13 +76,14 @@ class DistributedPress
|
|
73
76
|
# @param endpoint [String]
|
74
77
|
# @param io [IO]
|
75
78
|
# @param boundary [String]
|
79
|
+
# @param timeout [Integer]
|
76
80
|
# @return [Hash]
|
77
|
-
def put(endpoint:, io:, boundary:)
|
81
|
+
def put(endpoint:, io:, boundary:, timeout: 600)
|
78
82
|
multipart_headers = headers.dup
|
79
83
|
multipart_headers['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
|
80
84
|
multipart_headers['Transfer-Encoding'] = 'chunked'
|
81
85
|
|
82
|
-
self.class.put(endpoint, body_stream: io, headers: multipart_headers).tap do |response|
|
86
|
+
self.class.put(endpoint, body_stream: io, headers: multipart_headers, max_retries: 0, timeout: timeout).tap do |response|
|
83
87
|
process_response_errors! endpoint, response
|
84
88
|
end
|
85
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distributed-press-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|