yao 0.2.9 → 0.2.10

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
  SHA1:
3
- metadata.gz: 08ca28f5918055cfa17b21d7bb861ab5a936a562
4
- data.tar.gz: 431926d127435c8f9fc24cc2d7b7062e4e8e9210
3
+ metadata.gz: d25559958db2dcc6ae00ff5ae913199c5be23ebb
4
+ data.tar.gz: 67054283721a10858ee0180aa9d3b43f34fe01ac
5
5
  SHA512:
6
- metadata.gz: f8aa4f09ba1c91e01431a01e58cd2d0647f0929c027e4082212b4f21053c2d1ba3b331bfab094dda94cd2ff95ca3460113cce6cbe196891193f8c02ff38aa6a8
7
- data.tar.gz: 70c6ebc36160084980b71f02433a80627aedde7d18a1984b912a60793dbb07897d7f7117ff98b4a3b624a08b92781431328f5ce47bd01d6ffb2d95e98a3da253
6
+ metadata.gz: 791b232c1e756573c4556cec85c043074f6b1df31f9dd1fb793731d0c18990d2e91d565892c7b49fff93e4813b01c235f525141d722408349cc834116062ada6
7
+ data.tar.gz: e56a63c2c6dd5b51387f37a9d94e51e24b7afa64b20b5b69b93de31dd11a822add46ac1a7bd5262aeed91003d702dfcf8379f1de7b577fdfdc76a52e7fe0e6f4
data/README.md CHANGED
@@ -55,6 +55,8 @@ OpenStack.configure do
55
55
  tenant_name "fooproject"
56
56
  username "udzura"
57
57
  password "tonk0tsu-r@men"
58
+ # timeout is optional
59
+ timeout 300
58
60
  end
59
61
 
60
62
  OpenStack::Server.list_detail # And let's go on
data/lib/yao/auth.rb CHANGED
@@ -5,7 +5,7 @@ require 'time'
5
5
  require 'yao/token'
6
6
 
7
7
  module Yao
8
- %i(tenant_name username password).each do |name|
8
+ %i(tenant_name username password timeout).each do |name|
9
9
  Yao.config.param name, nil
10
10
  end
11
11
 
data/lib/yao/client.rb CHANGED
@@ -46,7 +46,7 @@ module Yao
46
46
  end
47
47
 
48
48
  def gen_client(endpoint, token: nil)
49
- Faraday.new( endpoint ) do |f|
49
+ Faraday.new( endpoint, client_options ) do |f|
50
50
  client_generator.call(f, token)
51
51
  end
52
52
  end
@@ -56,6 +56,12 @@ module Yao
56
56
  set.register_endpoints("default" => {public_url: new_endpoint || Yao.config.endpoint})
57
57
  self.default_client = set
58
58
  end
59
+
60
+ def client_options
61
+ opt = {}
62
+ opt.merge!({ request: { timeout: Yao.config.timeout }}) if Yao.config.timeout
63
+ opt
64
+ end
59
65
  end
60
66
 
61
67
  Yao.config.param :auth_url, nil do |endpoint|
data/lib/yao/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yao
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -49,4 +49,10 @@ class TestClient < Test::Unit::TestCase
49
49
  ]
50
50
  assert { cli.builder.handlers == handlers }
51
51
  end
52
+
53
+ def test_timeout
54
+ stub(Yao.config).timeout { 300 }
55
+ cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
56
+ assert { cli.options.timeout == 300 }
57
+ end
52
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yao
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uchio, KONDO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  version: '0'
234
234
  requirements: []
235
235
  rubyforge_project:
236
- rubygems_version: 2.2.3
236
+ rubygems_version: 2.4.8
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Yet Another OpenStack API Wrapper that rocks!!