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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09f71e09f61293cb354565f20333c6942f88d31caca5eb5e87c2afc8ea5a1107'
4
- data.tar.gz: dc450c71c73b5060eaa6d732f4cc59f6f0007f928052d0b28f478b9d028ebf73
3
+ metadata.gz: 7cc2e318b07cdd179bf6a7817f3f35fbf0adb2ec2ea10c3a507b8f565605c469
4
+ data.tar.gz: 51f43af7ba7cb51de03419f473cd20a3a39f42ff24542f8fb9a346bbbd8dc441
5
5
  SHA512:
6
- metadata.gz: 21c02c3e7dc9b90355825d2e92a5da711ee3bf92ca9b3c8a43b875effcb2d461730f386efeac1aaac2cbf0c6baf8570e4d2ebb7ff595917599aaea19bf9c6f26
7
- data.tar.gz: 578c8266be6edb49bdd147793af2393b738b840b987c2e2bc97d984c3c0d23e9f26de55e07aceb588016d08943b0f07c49bd71017171a5853af1b595d922c1e0
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
- def initialize(url: 'https://api.distributed.press', token: nil)
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
@@ -3,5 +3,5 @@
3
3
  # API client
4
4
  class DistributedPress
5
5
  # Version
6
- VERSION = '0.2.0'
6
+ VERSION = '0.2.2'
7
7
  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.0
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-01-26 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable