deltacloud-client 0.0.9.5 → 0.0.9.6

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.
Files changed (2) hide show
  1. data/lib/deltacloud.rb +16 -0
  2. metadata +4 -4
data/lib/deltacloud.rb CHANGED
@@ -33,6 +33,22 @@ module DeltaCloud
33
33
  API.new(user_name, password, api_url, &block)
34
34
  end
35
35
 
36
+ # Check given credentials if their are valid against
37
+ # backend cloud provider
38
+ #
39
+ # @param [String, user_name] API user name
40
+ # @param [String, password] API password
41
+ # @param [String, user_name] API URL (eg. http://localhost:3001/api)
42
+ # @return [true|false]
43
+ def self.valid_credentials?(user_name, password, api_url)
44
+ api=API.new(user_name, password, api_url)
45
+ result = false
46
+ api.request(:get, '', :force_auth => '1') do |response|
47
+ result = true if response.code.eql?(200)
48
+ end
49
+ return result
50
+ end
51
+
36
52
  # Return a API driver for specified URL
37
53
  #
38
54
  # @param [String, url] API URL (eg. http://localhost:3001/api)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltacloud-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 97
4
+ hash: 103
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 9
10
- - 5
11
- version: 0.0.9.5
10
+ - 6
11
+ version: 0.0.9.6
12
12
  platform: ruby
13
13
  authors:
14
14
  - Red Hat, Inc.
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-02 00:00:00 +02:00
19
+ date: 2010-09-10 00:00:00 +02:00
20
20
  default_executable: deltacloudc
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency