datacatalog 0.4.20 → 0.4.21
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/datacatalog.gemspec +8 -2
- data/lib/resources/tag.rb +37 -0
- data/lib/resources/tagging.rb +37 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/tag_spec.rb +1 -0
- data/spec/tagging_spec.rb +1 -0
- data/tasks/test_api.rake +1 -1
- metadata +10 -4
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.
|
7
|
+
gem.version = '0.4.21'
|
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"
|
data/datacatalog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{datacatalog}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.21"
|
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-
|
12
|
+
s.date = %q{2010-10-03}
|
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 = [
|
@@ -46,6 +46,8 @@ Gem::Specification.new do |s|
|
|
46
46
|
"lib/resources/rating.rb",
|
47
47
|
"lib/resources/report.rb",
|
48
48
|
"lib/resources/source.rb",
|
49
|
+
"lib/resources/tag.rb",
|
50
|
+
"lib/resources/tagging.rb",
|
49
51
|
"lib/resources/user.rb",
|
50
52
|
"sandbox_api.yml.example",
|
51
53
|
"spec/about_spec.rb",
|
@@ -70,6 +72,8 @@ Gem::Specification.new do |s|
|
|
70
72
|
"spec/source_spec.rb",
|
71
73
|
"spec/spec.opts",
|
72
74
|
"spec/spec_helper.rb",
|
75
|
+
"spec/tag_spec.rb",
|
76
|
+
"spec/tagging_spec.rb",
|
73
77
|
"spec/user_spec.rb",
|
74
78
|
"tasks/rdoc.rake",
|
75
79
|
"tasks/spec.rake",
|
@@ -102,6 +106,8 @@ Gem::Specification.new do |s|
|
|
102
106
|
"spec/setup_api.rb",
|
103
107
|
"spec/source_spec.rb",
|
104
108
|
"spec/spec_helper.rb",
|
109
|
+
"spec/tag_spec.rb",
|
110
|
+
"spec/tagging_spec.rb",
|
105
111
|
"spec/user_spec.rb"
|
106
112
|
]
|
107
113
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module DataCatalog
|
2
|
+
|
3
|
+
class Tag < Base
|
4
|
+
|
5
|
+
def self.all(conditions={})
|
6
|
+
cursor(uri, query_hash(conditions))
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.create(params={})
|
10
|
+
one(http_post(uri, :body => params))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.destroy(id)
|
14
|
+
one(http_delete(uri(id)))
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.first(conditions={})
|
18
|
+
_first(http_get(uri, :query => query_hash(conditions)))
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get(id)
|
22
|
+
one(http_get(uri(id)))
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.update(id, params={})
|
26
|
+
one(http_put(uri(id), :body => params))
|
27
|
+
end
|
28
|
+
|
29
|
+
# == Helpers
|
30
|
+
|
31
|
+
def self.uri(id=nil)
|
32
|
+
"/tags/#{id}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module DataCatalog
|
2
|
+
|
3
|
+
class Tagging < Base
|
4
|
+
|
5
|
+
def self.all(conditions={})
|
6
|
+
cursor(uri, query_hash(conditions))
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.create(params={})
|
10
|
+
one(http_post(uri, :body => params))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.destroy(id)
|
14
|
+
one(http_delete(uri(id)))
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.first(conditions={})
|
18
|
+
_first(http_get(uri, :query => query_hash(conditions)))
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get(id)
|
22
|
+
one(http_get(uri(id)))
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.update(id, params={})
|
26
|
+
one(http_put(uri(id), :body => params))
|
27
|
+
end
|
28
|
+
|
29
|
+
# == Helpers
|
30
|
+
|
31
|
+
def self.uri(id=nil)
|
32
|
+
"/taggings/#{id}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,8 +9,8 @@ alias :executing :lambda
|
|
9
9
|
|
10
10
|
KLASSES = [
|
11
11
|
DataCatalog::BrokenLink,
|
12
|
-
DataCatalog::Category,
|
13
12
|
DataCatalog::Categorization,
|
13
|
+
DataCatalog::Category,
|
14
14
|
DataCatalog::Comment,
|
15
15
|
DataCatalog::Document,
|
16
16
|
DataCatalog::Download,
|
@@ -22,6 +22,8 @@ KLASSES = [
|
|
22
22
|
DataCatalog::Rating,
|
23
23
|
DataCatalog::Report,
|
24
24
|
DataCatalog::Source,
|
25
|
+
DataCatalog::Tag,
|
26
|
+
DataCatalog::Tagging,
|
25
27
|
]
|
26
28
|
|
27
29
|
def clean_slate
|
data/spec/tag_spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
data/tasks/test_api.rake
CHANGED
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:
|
4
|
+
hash: 37
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 21
|
10
|
+
version: 0.4.21
|
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-
|
19
|
+
date: 2010-10-03 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -186,6 +186,8 @@ files:
|
|
186
186
|
- lib/resources/rating.rb
|
187
187
|
- lib/resources/report.rb
|
188
188
|
- lib/resources/source.rb
|
189
|
+
- lib/resources/tag.rb
|
190
|
+
- lib/resources/tagging.rb
|
189
191
|
- lib/resources/user.rb
|
190
192
|
- sandbox_api.yml.example
|
191
193
|
- spec/about_spec.rb
|
@@ -210,6 +212,8 @@ files:
|
|
210
212
|
- spec/source_spec.rb
|
211
213
|
- spec/spec.opts
|
212
214
|
- spec/spec_helper.rb
|
215
|
+
- spec/tag_spec.rb
|
216
|
+
- spec/tagging_spec.rb
|
213
217
|
- spec/user_spec.rb
|
214
218
|
- tasks/rdoc.rake
|
215
219
|
- tasks/spec.rake
|
@@ -270,4 +274,6 @@ test_files:
|
|
270
274
|
- spec/setup_api.rb
|
271
275
|
- spec/source_spec.rb
|
272
276
|
- spec/spec_helper.rb
|
277
|
+
- spec/tag_spec.rb
|
278
|
+
- spec/tagging_spec.rb
|
273
279
|
- spec/user_spec.rb
|