occi-api 4.2.0.beta.16 → 4.2.0.beta.17

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
  SHA1:
3
- metadata.gz: a279571e2ef67054f9f5ccaee15e3c3fe9aca22e
4
- data.tar.gz: 1160d56dfc697c18f2b1dc0ae0e8522a5e1bd3ba
3
+ metadata.gz: 028662a3144ea5e6358cf09aa95bf695b34bbd7a
4
+ data.tar.gz: 75563451bd917491cdb3c2266940335011a2dd5b
5
5
  SHA512:
6
- metadata.gz: a484c7cf79840350dcdfdde41fd18cf3ea0abad52542f9bf32f98aaadf711f108f3208f3dba423b3a9598d7ac3b22aaa6848d7ecca73c30f319f1d16731164c1
7
- data.tar.gz: 7c323695265fc8bac570329e39a26523294ed6c55c10a7f5ca126d322a09c8578ff91f1c8ce13a2e4b172dd216aecc8b2b9acd2a643caf653990175c36bbae00
6
+ metadata.gz: d0174b927e6e39b06a9b2d7f4302a75cc38ef4c9b5d4055900496c210d42c65ace37ddd98886f98ed9b3f38d31a3623e041f6e8f0bc9471b07ac36f18f7b0178
7
+ data.tar.gz: 0d47b24bb194e2eb04f140ddcad0599e9a00e418c9969fbfddf1f3eeb8378dcfe530cd868c614cbcfee1b7a10dd16c8c27fdbfb9be288372ed0393011e4d77b0
@@ -3,6 +3,19 @@ module Occi::Api::Client
3
3
 
4
4
  module ProtectedStubs
5
5
 
6
+ # Sets global connection options before the first call
7
+ # to a remote server is made. For example, this allows
8
+ # the configuration of a global connection timeout, including
9
+ # pre-authentication and authentication calls.
10
+ #
11
+ # @example
12
+ # configure_connection { :timeout => 180 }
13
+ #
14
+ # @param options [Hash] global options
15
+ def configure_connection(options)
16
+ raise Occi::Api::Client::Errors::NotImplementedError, "#{__method__} is just a stub!"
17
+ end
18
+
6
19
  # Sets auth method and appropriate httparty attributes. Supported auth methods
7
20
  # are: ["basic", "digest", "x509", "none"]
8
21
  #
@@ -31,6 +31,9 @@ module Occi::Api::Client
31
31
  # check the validity and canonize the endpoint URI
32
32
  @endpoint = get_endpoint_uri(@options[:endpoint])
33
33
 
34
+ # set global connection options, such as timeout
35
+ configure_connection(@options)
36
+
34
37
  # pass auth options
35
38
  @auth_options = get_auth(@options[:auth])
36
39
 
@@ -40,8 +40,9 @@ module Occi::Api::Client
40
40
  def initialize(options = {})
41
41
  super options
42
42
 
43
+ # set a global base URI for all subsequent requests
44
+ # must be done after authN calls
43
45
  self.class.base_uri @endpoint.to_s
44
- self.class.default_timeout @options[:timeout].to_i unless @options[:timeout].blank?
45
46
 
46
47
  # get model information from the endpoint
47
48
  # and create Occi::Model instance
@@ -11,6 +11,12 @@ module Occi::Api::Client
11
11
  logger
12
12
  end
13
13
 
14
+ # @see Occi::Api::Client::ClientBase
15
+ def configure_connection(options)
16
+ # timeout is the only global connection option at the moment
17
+ self.class.default_timeout options[:timeout].to_i unless options[:timeout].blank?
18
+ end
19
+
14
20
  # @see Occi::Api::Client::ClientBase
15
21
  def get_auth(auth_options, fallback = false)
16
22
  # select appropriate authN type
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Api
3
- VERSION = "4.2.0.beta.16" unless defined?(::Occi::Api::VERSION)
3
+ VERSION = "4.2.0.beta.17" unless defined?(::Occi::Api::VERSION)
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0.beta.16
4
+ version: 4.2.0.beta.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-15 00:00:00.000000000 Z
13
+ date: 2014-02-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: occi-core