iq_triplestorage 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,6 @@ Gem::Specification.new do |s|
10
10
  s.rubyforge_project = s.name
11
11
  s.authors = ["FND"]
12
12
 
13
- s.add_dependency "typhoeus"
14
-
15
13
  s.files = `git ls-files`.split("\n")
16
14
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
15
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
@@ -1,3 +1,3 @@
1
1
  module IqTriplestorage
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -57,15 +57,11 @@ module IqTriplestorage
57
57
  filename = uri.gsub(/[^0-9A-Za-z]/, "_") # XXX: too simplistic?
58
58
  path = "/DAV/home/#{@username}/rdf_sink/#{filename}"
59
59
 
60
- auth = Base64.encode64([@username, @password].join(":")).strip
61
- headers = {
62
- "Authorization" => "Basic #{auth}", # XXX: seems like this should be built into Typhoeus!?
60
+ res = http_request("PUT", path, rdf_data, { # XXX: is PUT correct here?
63
61
  "Content-Type" => content_type
64
- }
65
- res = Typhoeus::Request.put("#{@host}:#{@port}#{path}", # XXX: is PUT correct here?
66
- :headers => headers, :body => rdf_data)
62
+ })
67
63
 
68
- return res.code == 201
64
+ return res.code == "201"
69
65
  end
70
66
 
71
67
  def sparql_pull(query)
@@ -79,21 +75,16 @@ module IqTriplestorage
79
75
  # query is a string or an array of strings
80
76
  def sparql_query(query)
81
77
  query = query.join("\n\n") + "\n" rescue query
82
-
83
78
  path = "/DAV/home/#{@username}/query"
84
79
 
85
- auth = Base64.encode64([@username, @password].join(":")).strip
86
- headers = {
87
- "Authorization" => "Basic #{auth}", # XXX: seems like this should be built into Typhoeus!?
80
+ res = http_request("POST", path, query, {
88
81
  "Content-Type" => "application/sparql-query"
89
- }
90
- res = Typhoeus::Request.post("#{@host}:#{@port}#{path}",
91
- :headers => headers, :body => query)
82
+ })
92
83
 
93
- return res.code == 201
84
+ return res.code == "201"
94
85
  end
95
86
 
96
- def http_request(method, path, body, headers={}) # TODO: switch to Typhoeus
87
+ def http_request(method, path, body, headers={})
97
88
  uri = URI.parse("#{@host}:#{@port}#{path}")
98
89
 
99
90
  req = Net::HTTP.const_get(method.downcase.capitalize).new(uri.to_s)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iq_triplestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-30 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: typhoeus
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
12
+ date: 2012-11-06 00:00:00.000000000 Z
13
+ dependencies: []
30
14
  description:
31
15
  email:
32
16
  executables: []
@@ -57,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
41
  version: '0'
58
42
  segments:
59
43
  - 0
60
- hash: 1344314608360584677
44
+ hash: -61097333321092672
61
45
  required_rubygems_version: !ruby/object:Gem::Requirement
62
46
  none: false
63
47
  requirements:
@@ -66,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
50
  version: '0'
67
51
  segments:
68
52
  - 0
69
- hash: 1344314608360584677
53
+ hash: -61097333321092672
70
54
  requirements: []
71
55
  rubyforge_project: iq_triplestorage
72
56
  rubygems_version: 1.8.23