cfoundry 0.3.47 → 0.3.48
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cfoundry/baseclient.rb +3 -0
- data/lib/cfoundry/uaaclient.rb +13 -3
- data/lib/cfoundry/v1/base.rb +1 -1
- data/lib/cfoundry/v1/client.rb +7 -4
- data/lib/cfoundry/v1/service.rb +5 -7
- data/lib/cfoundry/version.rb +1 -1
- metadata +4 -4
data/lib/cfoundry/baseclient.rb
CHANGED
@@ -62,6 +62,7 @@ module CFoundry
|
|
62
62
|
payload = options.delete(:payload)
|
63
63
|
params = options.delete(:params)
|
64
64
|
return_headers = options.delete(:return_headers)
|
65
|
+
return_response = options.delete(:return_response)
|
65
66
|
|
66
67
|
headers = {}
|
67
68
|
headers["Authorization"] = @token if @token
|
@@ -137,6 +138,8 @@ module CFoundry
|
|
137
138
|
|
138
139
|
if return_headers
|
139
140
|
sane_headers(response)
|
141
|
+
elsif return_response
|
142
|
+
response
|
140
143
|
elsif [Net::HTTP::Get, Net::HTTP::Head].include?(method) && \
|
141
144
|
response.is_a?(Net::HTTPRedirection)
|
142
145
|
request_uri(URI.parse(response["location"]), method, original_options)
|
data/lib/cfoundry/uaaclient.rb
CHANGED
@@ -23,14 +23,24 @@ module CFoundry
|
|
23
23
|
:redirect_uri => @redirect_uri
|
24
24
|
}
|
25
25
|
|
26
|
-
|
26
|
+
auth =
|
27
27
|
post(
|
28
28
|
{ :credentials => credentials },
|
29
29
|
"oauth", "authorize",
|
30
|
-
:
|
30
|
+
:return_response => true,
|
31
31
|
:content => :form,
|
32
32
|
:accept => :json,
|
33
|
-
:params => query)
|
33
|
+
:params => query)
|
34
|
+
|
35
|
+
case auth
|
36
|
+
when Net::HTTPRedirection
|
37
|
+
extract_token(auth["location"])
|
38
|
+
else
|
39
|
+
json = parse_json(auth.body)
|
40
|
+
raise CFoundry::Denied.new(
|
41
|
+
auth.code.to_i,
|
42
|
+
json[:error_description])
|
43
|
+
end
|
34
44
|
end
|
35
45
|
|
36
46
|
def users
|
data/lib/cfoundry/v1/base.rb
CHANGED
data/lib/cfoundry/v1/client.rb
CHANGED
@@ -87,10 +87,13 @@ module CFoundry::V1
|
|
87
87
|
services = []
|
88
88
|
|
89
89
|
@base.system_services.each do |type, vendors|
|
90
|
-
vendors.each do |vendor,
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
vendors.each do |vendor, providers|
|
91
|
+
providers.each do |provider, versions|
|
92
|
+
versions.each do |num, meta|
|
93
|
+
services <<
|
94
|
+
Service.new(vendor.to_s, num.to_s, meta[:description],
|
95
|
+
type, provider.to_s)
|
96
|
+
end
|
94
97
|
end
|
95
98
|
end
|
96
99
|
end
|
data/lib/cfoundry/v1/service.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module CFoundry::V1
|
2
2
|
class Service
|
3
|
-
attr_accessor :label, :version, :description, :type
|
3
|
+
attr_accessor :label, :version, :description, :type, :provider
|
4
4
|
|
5
|
-
def initialize(label, version = nil, description = nil,
|
5
|
+
def initialize(label, version = nil, description = nil,
|
6
|
+
type = nil, provider = "core")
|
6
7
|
@label = label
|
7
8
|
@description = description
|
8
9
|
@version = version
|
9
|
-
@type =
|
10
|
+
@type = type
|
11
|
+
@provider = provider
|
10
12
|
end
|
11
13
|
|
12
14
|
def eql?(other)
|
@@ -14,10 +16,6 @@ module CFoundry::V1
|
|
14
16
|
end
|
15
17
|
alias :== :eql?
|
16
18
|
|
17
|
-
def provider
|
18
|
-
"core"
|
19
|
-
end
|
20
|
-
|
21
19
|
def active
|
22
20
|
true
|
23
21
|
end
|
data/lib/cfoundry/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 115
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 48
|
10
|
+
version: 0.3.48
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: multipart-post
|