pho 0.0.1

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.
@@ -0,0 +1,54 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'pho'
3
+ require 'test/unit'
4
+ require 'mocha'
5
+
6
+ class SearchTest < Test::Unit::TestCase
7
+
8
+ def test_simple_search
9
+ mc = mock()
10
+ mc.stub_everything()
11
+ mc.expects(:get).with("http://api.talis.com/stores/testing/items", {"query" => "lunar"}, nil)
12
+
13
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
14
+ s = store.search("lunar")
15
+ end
16
+
17
+ def test_parameter_search
18
+ mc = mock()
19
+ mc.stub_everything()
20
+ mc.expects(:get).with("http://api.talis.com/stores/testing/items", {"query" => "lunar", "max" => "50", "offset" => "10"}, nil)
21
+
22
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
23
+ s = store.search("lunar", {"max" => "50", "offset" => "10"})
24
+ end
25
+
26
+ def test_facet
27
+ mc = mock()
28
+ mc.expects(:set_auth)
29
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/facet", {"query" => "lunar", "fields" => "name,agency"}, nil)
30
+
31
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
32
+ s = store.facet("lunar", ["name", "agency"] )
33
+ end
34
+
35
+ def test_augment_uri
36
+ mc = mock()
37
+ mc.expects(:set_auth)
38
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/augment", {"data-uri" => "http://www.example.org/index.rss"}, nil)
39
+
40
+
41
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
42
+ response = store.augment_uri("http://www.example.org/index.rss")
43
+ end
44
+
45
+ def test_augment
46
+ mc = mock()
47
+ mc.expects(:set_auth)
48
+ mc.expects(:post).with("http://api.talis.com/stores/testing/services/augment", "data", nil)
49
+
50
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
51
+ response = store.augment("data")
52
+
53
+ end
54
+ end
@@ -0,0 +1,76 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'pho'
3
+ require 'test/unit'
4
+ require 'mocha'
5
+
6
+ class SparqlTest < Test::Unit::TestCase
7
+
8
+ def test_simple_sparql
9
+
10
+ mc = mock()
11
+ mc.expects(:set_auth)
12
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/rdf+xml"} ).returns(
13
+ HTTP::Message.new_response("RESULTS"))
14
+
15
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
16
+ response = store.sparql("SPARQL", "application/rdf+xml")
17
+ assert_equal("RESULTS", response.content)
18
+ end
19
+
20
+ def test_sparql_with_mimetype
21
+
22
+ mc = mock()
23
+ mc.expects(:set_auth)
24
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/sparql-results+json"} ).returns(
25
+ HTTP::Message.new_response("RESULTS"))
26
+
27
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
28
+ response = store.sparql("SPARQL", "application/sparql-results+json")
29
+ assert_equal("RESULTS", response.content)
30
+ end
31
+
32
+ def test_sparql_ask
33
+ mc = mock()
34
+ mc.expects(:set_auth)
35
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/sparql-results+xml"} ).returns(
36
+ HTTP::Message.new_response("RESULTS"))
37
+
38
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
39
+ response = store.sparql_ask("SPARQL")
40
+ assert_equal("RESULTS", response.content)
41
+ end
42
+
43
+ def test_sparql_select
44
+ mc = mock()
45
+ mc.expects(:set_auth)
46
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/sparql-results+xml"} ).returns(
47
+ HTTP::Message.new_response("RESULTS"))
48
+
49
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
50
+ response = store.sparql_select("SPARQL")
51
+ assert_equal("RESULTS", response.content)
52
+ end
53
+
54
+ def test_sparql_construct
55
+ mc = mock()
56
+ mc.expects(:set_auth)
57
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/rdf+xml"} ).returns(
58
+ HTTP::Message.new_response("RESULTS"))
59
+
60
+ store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
61
+ response = store.sparql_construct("SPARQL")
62
+ assert_equal("RESULTS", response.content)
63
+ end
64
+
65
+ def test_sparql_describe
66
+ mc = mock()
67
+ mc.expects(:set_auth)
68
+ mc.expects(:get).with("http://api.talis.com/stores/testing/services/sparql", {"query" => "SPARQL"}, {"Accept" => "application/rdf+xml"} ).returns(
69
+ HTTP::Message.new_response("RESULTS"))
70
+
71
+ store = Pho::Store.new("http://api.talis.com/stores/testing/", "user", "pass", mc)
72
+ response = store.sparql_describe("SPARQL")
73
+ assert_equal("RESULTS", response.content)
74
+ end
75
+
76
+ end
@@ -0,0 +1,14 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'pho'
3
+ require 'test/unit'
4
+
5
+ class StoreUtilTest < Test::Unit::TestCase
6
+
7
+ def test_build_uri
8
+ store = Pho::Store.new("http://api.talis.com/stores/testing")
9
+
10
+ assert_equal("http://api.talis.com/stores/testing/meta", store.build_uri("/meta") )
11
+ assert_equal("http://api.talis.com/stores/testing/meta", store.build_uri("meta") )
12
+ assert_equal("http://api.talis.com/stores/testing/meta", store.build_uri("http://api.talis.com/stores/testing/meta") )
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'test/unit'
3
+ require 'tc_store_util.rb'
4
+ require 'tc_etags.rb'
5
+ require 'tc_contentbox.rb'
6
+ require 'tc_metabox.rb'
7
+ require 'tc_jobcontrol.rb'
8
+ require 'tc_search.rb'
9
+ require 'tc_sparql.rb'
10
+ require 'tc_rdf_collection.rb'
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pho
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Leigh Dodds
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-21 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httpclient
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.3.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.3
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: mocha
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.9.5
44
+ version:
45
+ description: Ruby client for the Talis Platform
46
+ email: leigh.dodds@talis.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - README
53
+ files:
54
+ - README
55
+ - Rakefile
56
+ - tests/tc_metabox.rb
57
+ - tests/tc_store_util.rb
58
+ - tests/tc_contentbox.rb
59
+ - tests/tc_sparql.rb
60
+ - tests/tc_rdf_collection.rb
61
+ - tests/ts_pho.rb
62
+ - tests/tc_jobcontrol.rb
63
+ - tests/tc_search.rb
64
+ - tests/tc_etags.rb
65
+ - lib/test.rb
66
+ - lib/pho.rb
67
+ - lib/pho
68
+ - lib/pho/etags.rb
69
+ - lib/pho/rdf_collection.rb
70
+ - lib/pho/store.rb
71
+ has_rdoc: true
72
+ homepage: http://pho.rubyforge.net
73
+ post_install_message:
74
+ rdoc_options:
75
+ - --quiet
76
+ - --title
77
+ - Pho (Talis Platform Client) Reference
78
+ - --main
79
+ - README
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: "0"
93
+ version:
94
+ requirements: []
95
+
96
+ rubyforge_project: pho
97
+ rubygems_version: 1.2.0
98
+ signing_key:
99
+ specification_version: 2
100
+ summary: Ruby client for the Talis Platform
101
+ test_files:
102
+ - tests/ts_pho.rb