cfoundry 4.6.3.rc2 → 4.6.3.rc3
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.
- data/lib/cfoundry/v2/base.rb +1 -2
- data/lib/cfoundry/version.rb +1 -1
- data/spec/cfoundry/v2/model_spec.rb +11 -11
- metadata +4 -4
data/lib/cfoundry/v2/base.rb
CHANGED
|
@@ -91,8 +91,7 @@ module CFoundry::V2
|
|
|
91
91
|
def for_each(paginated, &block)
|
|
92
92
|
paginated[:resources].each &block
|
|
93
93
|
|
|
94
|
-
while next_page = paginated[:next_url]
|
|
95
|
-
next_page = URI.escape(paginated[:next_url])
|
|
94
|
+
while (next_page = paginated[:next_url])
|
|
96
95
|
paginated = get(next_page, :accept => :json)
|
|
97
96
|
paginated[:resources].each &block
|
|
98
97
|
end
|
data/lib/cfoundry/version.rb
CHANGED
|
@@ -395,29 +395,29 @@ module CFoundry
|
|
|
395
395
|
end
|
|
396
396
|
end
|
|
397
397
|
|
|
398
|
-
describe
|
|
399
|
-
|
|
398
|
+
describe '#for_each' do
|
|
400
399
|
before do
|
|
400
|
+
next_url = '/v2/test_models?page=2&q=timestamp%3E2012-11-01T12:00:00Z%3Btimestamp%3C2012-11-01T13:00:00Z&results-per-page=50'
|
|
401
401
|
|
|
402
402
|
WebMock.stub_request(:get, /v2\/test_models\?inline-relations-depth=1/).to_return(:body => {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
'prev_url' => nil,
|
|
404
|
+
'next_url' => next_url,
|
|
405
|
+
'resources' => [{:metadata => {:guid => '1'}}, {:metadata => {:guid => '2'}}]
|
|
406
406
|
}.to_json).times(1)
|
|
407
407
|
|
|
408
|
-
WebMock.stub_request(:get, /
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
WebMock.stub_request(:get, /#{Regexp.escape(next_url)}/).to_return(:body => {
|
|
409
|
+
'prev_url' => nil,
|
|
410
|
+
'next_url' => nil,
|
|
411
|
+
'resources' => [{:metadata => {:guid => '3'}}]
|
|
412
412
|
}.to_json).times(1)
|
|
413
413
|
end
|
|
414
414
|
|
|
415
|
-
it
|
|
415
|
+
it 'yields each page to the given the block' do
|
|
416
416
|
results = []
|
|
417
417
|
client.test_models_for_each do |test_model|
|
|
418
418
|
results << test_model
|
|
419
419
|
end
|
|
420
|
-
results.
|
|
420
|
+
results.map(&:guid).should == %w{1 2 3}
|
|
421
421
|
results.first.should be_a TestModel
|
|
422
422
|
end
|
|
423
423
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cfoundry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.6.3.
|
|
4
|
+
version: 4.6.3.rc3
|
|
5
5
|
prerelease: 6
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-11-
|
|
13
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activemodel
|
|
@@ -468,7 +468,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
468
468
|
version: '0'
|
|
469
469
|
segments:
|
|
470
470
|
- 0
|
|
471
|
-
hash:
|
|
471
|
+
hash: 2396132430484956375
|
|
472
472
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
473
473
|
none: false
|
|
474
474
|
requirements:
|
|
@@ -477,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
477
477
|
version: 1.3.1
|
|
478
478
|
requirements: []
|
|
479
479
|
rubyforge_project: cfoundry
|
|
480
|
-
rubygems_version: 1.8.
|
|
480
|
+
rubygems_version: 1.8.25
|
|
481
481
|
signing_key:
|
|
482
482
|
specification_version: 3
|
|
483
483
|
summary: High-level library for working with the Cloud Foundry API.
|