distributed-press-api-client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 836e345691ad1ed5a6899ebc8bcfcb638e5b2d8fddfb6f947c84c2bd94f155b0
4
- data.tar.gz: efe7d11dac7c925d328c0be16185e24a095be59ec11eedb223a30dfb9142f77c
3
+ metadata.gz: 7cc2e318b07cdd179bf6a7817f3f35fbf0adb2ec2ea10c3a507b8f565605c469
4
+ data.tar.gz: 51f43af7ba7cb51de03419f473cd20a3a39f42ff24542f8fb9a346bbbd8dc441
5
5
  SHA512:
6
- metadata.gz: 10d33a9cc5f31928b07917a7db36bbdc21bfc3eb33f984eaa76aa760614fcdd6b929c8b0061e25388c691889ec187459a607f26ca75727a865fbab65857c6eb1
7
- data.tar.gz: ad57ee2402ac1bcbb0359b14206d8fde897f9d66daa944b089ad8b80a6a5e5d46adf91244e259219a58ce419d958d516835bd266bdb00baa16656f38097524d7
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.1'
6
+ VERSION = '0.2.2'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed-press-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - f