cfoundry 0.3.48 → 0.3.49
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cfoundry/v1/client.rb +10 -0
- data/lib/cfoundry/v2/base.rb +3 -8
- data/lib/cfoundry/v2/client.rb +11 -4
- data/lib/cfoundry/version.rb +1 -1
- metadata +4 -4
data/lib/cfoundry/v1/client.rb
CHANGED
@@ -24,6 +24,16 @@ module CFoundry::V1
|
|
24
24
|
@base.target
|
25
25
|
end
|
26
26
|
|
27
|
+
# Current authentication token.
|
28
|
+
def token
|
29
|
+
@base.token
|
30
|
+
end
|
31
|
+
|
32
|
+
# Set the authentication token.
|
33
|
+
def token=(token)
|
34
|
+
@base.token = token
|
35
|
+
end
|
36
|
+
|
27
37
|
# Current proxy user. Usually nil.
|
28
38
|
def proxy
|
29
39
|
@base.proxy
|
data/lib/cfoundry/v2/base.rb
CHANGED
@@ -68,11 +68,8 @@ module CFoundry::V2
|
|
68
68
|
end
|
69
69
|
|
70
70
|
define_method(plural) do |*args|
|
71
|
-
params = params_from(args)
|
72
|
-
|
73
71
|
all_pages(
|
74
|
-
params
|
75
|
-
get("v2", plural, :accept => :json, :params => params))
|
72
|
+
get("v2", plural, :accept => :json, :params => params_from(args)))
|
76
73
|
end
|
77
74
|
end
|
78
75
|
|
@@ -130,13 +127,11 @@ module CFoundry::V2
|
|
130
127
|
params
|
131
128
|
end
|
132
129
|
|
133
|
-
def all_pages(
|
130
|
+
def all_pages(paginated)
|
134
131
|
payload = paginated[:resources]
|
135
132
|
|
136
133
|
while next_page = paginated[:next_url]
|
137
|
-
paginated = request_path(
|
138
|
-
Net::HTTP::Get, next_page, :accept => :json, :params => params)
|
139
|
-
|
134
|
+
paginated = request_path(:get, next_page, nil => :json)
|
140
135
|
payload += paginated[:resources]
|
141
136
|
end
|
142
137
|
|
data/lib/cfoundry/v2/client.rb
CHANGED
@@ -44,6 +44,16 @@ module CFoundry::V2
|
|
44
44
|
@base.target
|
45
45
|
end
|
46
46
|
|
47
|
+
# Current authentication token.
|
48
|
+
def token
|
49
|
+
@base.token
|
50
|
+
end
|
51
|
+
|
52
|
+
# Set the authentication token.
|
53
|
+
def token=(token)
|
54
|
+
@base.token = token
|
55
|
+
end
|
56
|
+
|
47
57
|
# Current proxy user. Usually nil.
|
48
58
|
def proxy
|
49
59
|
@base.proxy
|
@@ -219,15 +229,12 @@ module CFoundry::V2
|
|
219
229
|
end
|
220
230
|
|
221
231
|
define_method(:"#{plural}_from") do |path, *args|
|
222
|
-
params = @base.params_from(args)
|
223
|
-
|
224
232
|
objs = @base.all_pages(
|
225
|
-
params,
|
226
233
|
@base.request_path(
|
227
234
|
Net::HTTP::Get,
|
228
235
|
path,
|
229
236
|
:accept => :json,
|
230
|
-
:params =>
|
237
|
+
:params => @base.params_from(args)))
|
231
238
|
|
232
239
|
objs.collect do |json|
|
233
240
|
send(:"make_#{singular}", json)
|
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: 113
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 49
|
10
|
+
version: 0.3.49
|
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-25 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: multipart-post
|