abiquo-api 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/abiquo-api.rb +13 -6
- data/lib/abiquo-api/httpclient.rb +6 -1
- data/lib/abiquo-api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcced71f2e3f6782763643d062ada792dabc6023
|
4
|
+
data.tar.gz: 862f2f8b982f93e35de263aecf45b1b513842f05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b149388d3bf38f6417f0a57667deb6022bfdda8cb597063d6f3dd9c45949b83b84467ae968a65b530d8911573c9e1767c851b00df239abf691f0f84dcec6fc
|
7
|
+
data.tar.gz: 0dbd1de15111dfa23fbdd04a65b47481e347bdcd86fd7773c0ab786867cbeb1e3788272721cb2878c0d0f4d63b7d40265cd48719f3b3154d82725679aac4f386
|
data/lib/abiquo-api.rb
CHANGED
@@ -56,13 +56,14 @@ class AbiquoAPI
|
|
56
56
|
api_password = options[:abiquo_password]
|
57
57
|
api_key = options[:abiquo_api_key]
|
58
58
|
api_secret = options[:abiquo_api_secret]
|
59
|
+
access_token = options[:abiquo_access_token]
|
59
60
|
token_key = options[:abiquo_token_key]
|
60
61
|
token_secret = options[:abiquo_token_secret]
|
61
62
|
connection_options = options[:connection_options] || {}
|
62
63
|
|
63
64
|
raise "You need to set :abiquo_api_url" if api_url.nil?
|
64
|
-
raise "You need to provide either basic auth or
|
65
|
-
(api_key.nil? or api_secret.nil? or token_key.nil? or token_secret.nil?)
|
65
|
+
raise "You need to provide either basic auth, oauth credentials or OpenID access token!!" if (api_username.nil? or api_password.nil?) and
|
66
|
+
(api_key.nil? or api_secret.nil? or token_key.nil? or token_secret.nil?) and (access_token.nil?)
|
66
67
|
|
67
68
|
unless api_key.nil?
|
68
69
|
credentials = {
|
@@ -72,10 +73,16 @@ class AbiquoAPI
|
|
72
73
|
:token_secret => token_secret
|
73
74
|
}
|
74
75
|
else
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
if access_token.nil?
|
77
|
+
credentials = {
|
78
|
+
:api_username => api_username,
|
79
|
+
:api_password => api_password
|
80
|
+
}
|
81
|
+
else
|
82
|
+
credentials = {
|
83
|
+
:access_token => access_token
|
84
|
+
}
|
85
|
+
end
|
79
86
|
end
|
80
87
|
|
81
88
|
@http_client = AbiquoAPIClient::HTTPClient.new(api_url,
|
@@ -33,7 +33,12 @@ module AbiquoAPIClient
|
|
33
33
|
# :ssl_verify_peer => <true_or_false>, :ssl_ca_path => <path_to_ca_file> }
|
34
34
|
#
|
35
35
|
def initialize(api_url, creds, connection_options)
|
36
|
-
if creds.has_key? :
|
36
|
+
if creds.has_key? :access_token
|
37
|
+
@connection = Faraday.new(api_url, connection_options) do |c|
|
38
|
+
c.authorization :Bearer, creds[:access_token]
|
39
|
+
c.adapter :excon
|
40
|
+
end
|
41
|
+
elsif creds.has_key? :consumer_key
|
37
42
|
@connection = Faraday.new(api_url, connection_options) do |c|
|
38
43
|
c.request :oauth, creds
|
39
44
|
c.adapter :excon
|
data/lib/abiquo-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abiquo-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Cirauqui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|