puppet_forge 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,8 +69,8 @@ module PuppetForge
69
69
  # @param parsed_data [Hash<(:data, :errors)>] the parsed response data
70
70
  # @return [PaginatedCollection] the collection
71
71
  def new_collection(parsed_data)
72
- col = super :data => parsed_data[:data][:results],
73
- :metadata => parsed_data[:data][:pagination],
72
+ col = super :data => parsed_data[:data][:results] || [],
73
+ :metadata => parsed_data[:data][:pagination] || { limit: 10, total: 0, offset: 0 },
74
74
  :errors => parsed_data[:errors]
75
75
 
76
76
  PaginatedCollection.new(self, col.to_a, col.metadata, col.errors)
@@ -1,3 +1,3 @@
1
1
  module PuppetForge
2
- VERSION = '1.0.0' # Library version
2
+ VERSION = '1.0.1' # Library version
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Puppet Labs"]
10
10
  spec.email = ["forge-team+api@puppetlabs.com"]
11
11
  spec.summary = "Access and manipulate the Puppet Forge API from Ruby."
12
- spec.homepage = "https://github.com/puppetlabs/puppet_forge"
12
+ spec.homepage = "https://github.com/puppetlabs/forge-ruby"
13
13
  spec.license = "Apache License, Version 2.0"
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe PuppetForge::V3::Base do
4
+ describe '::new_collection' do
5
+ it 'should handle responses with no results' do
6
+ response_data = { data: {}, errors: "Something bad happened!" }
7
+
8
+ PuppetForge::V3::Base.new_collection(response_data).should == []
9
+ end
10
+
11
+ it 'should handle responses with no pagination info' do
12
+ response_data = { data: {}, errors: "Something bad happened!" }
13
+
14
+ collection = PuppetForge::V3::Base.new_collection(response_data)
15
+
16
+ collection.limit.should == 10
17
+ collection.offset.should == 0
18
+ collection.total.should == 0
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_forge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-16 00:00:00.000000000 Z
12
+ date: 2014-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: her
@@ -191,12 +191,13 @@ files:
191
191
  - spec/fixtures/v3/users/puppetlabs.json
192
192
  - spec/spec_helper.rb
193
193
  - spec/unit/forge/v3/base/paginated_collection_spec.rb
194
+ - spec/unit/forge/v3/base_spec.rb
194
195
  - spec/unit/forge/v3/module_spec.rb
195
196
  - spec/unit/forge/v3/release_spec.rb
196
197
  - spec/unit/forge/v3/user_spec.rb
197
198
  - spec/unit/her/lazy_accessors_spec.rb
198
199
  - spec/unit/her/lazy_relations_spec.rb
199
- homepage: https://github.com/puppetlabs/puppet_forge
200
+ homepage: https://github.com/puppetlabs/forge-ruby
200
201
  licenses:
201
202
  - Apache License, Version 2.0
202
203
  post_install_message:
@@ -217,10 +218,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  version: '0'
218
219
  segments:
219
220
  - 0
220
- hash: 4321509104221939174
221
+ hash: -2215173485911600021
221
222
  requirements: []
222
223
  rubyforge_project:
223
- rubygems_version: 1.8.23
224
+ rubygems_version: 1.8.29
224
225
  signing_key:
225
226
  specification_version: 3
226
227
  summary: Access and manipulate the Puppet Forge API from Ruby.
@@ -253,6 +254,7 @@ test_files:
253
254
  - spec/fixtures/v3/users/puppetlabs.json
254
255
  - spec/spec_helper.rb
255
256
  - spec/unit/forge/v3/base/paginated_collection_spec.rb
257
+ - spec/unit/forge/v3/base_spec.rb
256
258
  - spec/unit/forge/v3/module_spec.rb
257
259
  - spec/unit/forge/v3/release_spec.rb
258
260
  - spec/unit/forge/v3/user_spec.rb