datacatalog 0.4.19 → 0.4.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datacatalog (0.4.19)
4
+ datacatalog (0.4.20)
5
5
  activesupport (~> 3.0.0)
6
6
  httparty (~> 0.6.1)
7
7
  mash (~> 0.1.1)
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ begin
4
4
  require 'jeweler'
5
5
  Jeweler::Tasks.new do |gem|
6
6
  gem.name = "datacatalog"
7
- gem.version = '0.4.19'
7
+ gem.version = '0.4.20'
8
8
  gem.summary = %Q{Client for the National Data Catalog API}
9
9
  gem.description = %Q{A Ruby client library for the National Data Catalog API}
10
10
  gem.email = "luigi@sunlightfoundation.com"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datacatalog}
8
- s.version = "0.4.19"
8
+ s.version = "0.4.20"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Luigi Montanez", "David James"]
12
- s.date = %q{2010-09-22}
12
+ s.date = %q{2010-09-29}
13
13
  s.description = %q{A Ruby client library for the National Data Catalog API}
14
14
  s.email = %q{luigi@sunlightfoundation.com}
15
15
  s.extra_rdoc_files = [
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -22,6 +22,10 @@ module DataCatalog
22
22
  one(http_get(uri(id)))
23
23
  end
24
24
 
25
+ def self.update(id, params={})
26
+ one(http_put(uri(id), :body => params))
27
+ end
28
+
25
29
  # == Helpers
26
30
 
27
31
  def self.uri(id=nil)
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -14,6 +14,10 @@ module DataCatalog
14
14
  one(http_delete(uri(id)))
15
15
  end
16
16
 
17
+ def self.first(conditions={})
18
+ _first(http_get(uri, :query => query_hash(conditions)))
19
+ end
20
+
17
21
  def self.get(id)
18
22
  one(http_get(uri(id)))
19
23
  end
@@ -25,14 +25,17 @@ KLASSES = [
25
25
  ]
26
26
 
27
27
  def clean_slate
28
- DataCatalog::User.all.each do |u|
29
- DataCatalog::User.destroy(u.id) unless u.name == "Primary Admin"
30
- end
31
- KLASSES.each do |klass|
32
- to_delete = []
33
- klass.all.each { |instance| to_delete << instance.id }
34
- to_delete.each { |id| klass.destroy(id) }
28
+ delete_all(DataCatalog::User) { |u| u.name != "Primary Admin" }
29
+ KLASSES.each { |klass| delete_all(klass) }
30
+ end
31
+
32
+ def delete_all(klass)
33
+ list = []
34
+ klass.all.each do |instance|
35
+ test = block_given? ? yield(instance) : true
36
+ list << instance.id if test
35
37
  end
38
+ list.each { |id| klass.destroy(id) }
36
39
  end
37
40
 
38
41
  def mangle(string)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacatalog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 19
10
- version: 0.4.19
9
+ - 20
10
+ version: 0.4.20
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luigi Montanez
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-22 00:00:00 -04:00
19
+ date: 2010-09-29 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency