xlogin-apiclient 0.2.4 → 0.2.5

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: cd27729125f85dccd148ba59aa2db26d534bc236c9845be12f5fde54b47925d2
4
- data.tar.gz: 483181f41617cdc735197e1206a21343f4c258da53f129f8d443e46d658b181e
3
+ metadata.gz: 8f3e532530879c3353dcfb7f59479eb4b0f0c1b399f89ee8c65dbf024cee76f5
4
+ data.tar.gz: 9ea1381765bf42a205d649f5eaf42b490f9dbfd16de7fde69d4843192f5c2156
5
5
  SHA512:
6
- metadata.gz: 296f10186c974b5e3e935c525a15299265543e8074b25f9dd5095abbddbdeabb009f96b58d49ae4be87ee34e535ba60dc399e14fbc3c4da1f68aa792053079d1
7
- data.tar.gz: c51ca168d18595df7171791277cf5290f6c8229d94250f14ad465828c3798102d90364e697d76c2d1980d6f2dd42ccfca1df22757be2b9c9c7e1071eaec365a3
6
+ metadata.gz: cb5e5d6fbcb8fcf18b41d39b71e87f39ae8a63622711668b369a3736185e12c772a3e95c440120302044936127cb1f3bb9136a891bd41cf7cc65b3ce511798b8
7
+ data.tar.gz: b877ebf767de4ae72912d31cc802a479e9284aed5515f7430b38ccccd2af2e48b5549c192a7a1c84581d7965f47ebef32ed3cf25d96e9b329d26edf4854cea8d
@@ -5,12 +5,16 @@ require 'addressable/uri'
5
5
  require 'em-eventsource'
6
6
  require "xlogin/apiclient/version"
7
7
 
8
+
8
9
  module Xlogin
9
10
  class APIClient
11
+ DEFAULT_TIMEOUT = 60
12
+
10
13
  class Error < StandardError; end
11
14
 
12
15
  class << self
13
16
  attr_accessor :base_url
17
+ attr_accessor :timeout
14
18
  end
15
19
 
16
20
  attr_reader :type, :args
@@ -55,6 +59,9 @@ module Xlogin
55
59
  req["Accept"] = "application/json"
56
60
 
57
61
  http = Net::HTTP.new(uri.host, uri.port)
62
+ http.open_timeout = self.class.timeout || DEFAULT_TIMEOUT
63
+ http.read_timeout = self.class.timeout || DEFAULT_TIMEOUT
64
+
58
65
  resp = http.request(req)
59
66
  raise Error.new(resp.message) unless resp.code =~ /^2[0-9]{2}$/
60
67
 
@@ -1,5 +1,5 @@
1
1
  module Xlogin
2
2
  module Apiclient
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlogin-apiclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - haccht