bodhi-slam 0.2.2 → 0.2.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bodhi-slam/resource.rb +25 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e24fa8d801c59a7acef1feb963981e247884d38
4
- data.tar.gz: d5a098d7fd280e9d59977342968aa2ea198e69b2
3
+ metadata.gz: 76c3a5ab9e27e73badc35dd7da2a78374025b7c5
4
+ data.tar.gz: d714537140fe349bd7d5fea95440c7642a50bb00
5
5
  SHA512:
6
- metadata.gz: 9abc1448b20db9dd36920067a0539f0d87f51cc159b5e56f26d5cd156e518e858dad4769545832616470de95af86a22694f3e98ada744d47d4ee29b5e5ab71a7
7
- data.tar.gz: e8063b4ab6dd1200d7c75d7ca28b9f0624b44789ef515e38e212b67b6ec7b52f69e3f63261d186246b19ed91968a3363f7a0ccf1885c6c54bd7eb6e6974a7bae
6
+ metadata.gz: fa60f89fd153e8469bc28d798ed45c04a4be982f3e36d51dc59d43c8052138eae7c1b434ea472970dcbd4632aba869957eed9f2c1e39b6e169901ce8edec8b4f
7
+ data.tar.gz: ba8b64e7a9c6fea5ea43de3dfd5e6314f075a6f549b3785bc9ba52f0a15b22d23a4548495d282ea55272a259cafd11b4095ac9967887062b5b61ee13f0e9f70e
@@ -30,6 +30,31 @@ module Bodhi
30
30
  factory.build(context, resource_attributes)
31
31
  end
32
32
 
33
+ def find_all(context)
34
+ raise context.errors unless context.valid?
35
+ page = 1
36
+ records = []
37
+
38
+ begin
39
+ result = context.connection.get do |request|
40
+ request.url "/#{context.namespace}/resources/#{name}?paging=page:#{page}"
41
+ request.headers[context.credentials_header] = context.credentials
42
+ end
43
+
44
+ if result.status != 200
45
+ errors = JSON.parse result.body
46
+ errors.each{|error| error['status'] = result.status } if errors.is_a? Array
47
+ errors["status"] = result.status if errors.is_a? Hash
48
+ raise errors.to_s
49
+ end
50
+
51
+ page += 1
52
+ records << JSON.parse(result.body)
53
+ end while records.size == 100
54
+
55
+ records.flatten.collect{ |record| factory.build(record) }
56
+ end
57
+
33
58
  def aggregate(context, pipeline)
34
59
  raise context.errors unless context.valid?
35
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bodhi-slam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - willdavis