agraph 0.1.0.beta2 → 0.1.0

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.
data/README.rdoc CHANGED
@@ -68,7 +68,11 @@ The result will be an array that holds arrays of all matching statements.
68
68
  Before coordinates can be added, a fitting type has to be requested from the database. Coordinates can have the
69
69
  cartesian (x and y) or spherical (latitude and longitude) type. When creating the type, also a range has to be defined.
70
70
 
71
- cartesian_type = repository.geometric.cartesian_type 1, 0, 0, 100, 100
71
+ cartesian_type = repository.geometric.cartesian_type :strip_width => 1,
72
+ :x_min => 0,
73
+ :y_min => 0,
74
+ :x_max => 100,
75
+ :y_max => 100
72
76
 
73
77
  The first argument specifies the strip width and the last four the top-left and bottom-right corner of the rectangle
74
78
  that represent the boundaries for any coordinate.
data/Rakefile CHANGED
@@ -9,8 +9,8 @@ task :default => :spec
9
9
 
10
10
  specification = Gem::Specification.new do |specification|
11
11
  specification.name = "agraph"
12
- specification.version = "0.1.0.beta2"
13
- specification.date = "2010-03-30"
12
+ specification.version = "0.1.0"
13
+ specification.date = "2010-04-05"
14
14
  specification.email = "b.phifty@gmail.com"
15
15
  specification.homepage = "http://github.com/phifty/agraph"
16
16
  specification.summary = "Client for the AllegroGraph 4.x graph database."
@@ -1,7 +1,6 @@
1
1
  require 'uri'
2
2
  require 'cgi'
3
3
  require 'net/http'
4
- require 'base64'
5
4
  require 'json'
6
5
 
7
6
  module AllegroGraph
@@ -42,8 +41,11 @@ module AllegroGraph
42
41
  end
43
42
 
44
43
  def initialize_request_path
45
- serialize_parameters
46
- @request_path = @uri.path + @serialized_parameters
44
+ @request_path = @uri.path # + (@uri.query ? "?" + @uri.query : "")
45
+ unless parameter_body?
46
+ serialize_parameters
47
+ @request_path += @serialized_parameters
48
+ end
47
49
  end
48
50
 
49
51
  def serialize_parameters
@@ -72,8 +74,10 @@ module AllegroGraph
72
74
  end
73
75
 
74
76
  def initialize_request_body
75
- return unless [ :post, :put ].include?(@http_method.to_sym)
76
- @request.body = @body ? @body : @serialized_parameters.sub(/^\?/, "")
77
+ if parameter_body?
78
+ serialize_parameters
79
+ @request.body = @body ? @body : @serialized_parameters.sub(/^\?/, "")
80
+ end
77
81
  end
78
82
 
79
83
  def perform_request
@@ -82,6 +86,10 @@ module AllegroGraph
82
86
  end
83
87
  end
84
88
 
89
+ def parameter_body?
90
+ [ :post, :put ].include? @http_method.to_sym
91
+ end
92
+
85
93
  def self.request(http_method, url, options = { })
86
94
  transport = new http_method, url, options
87
95
  transport.perform
@@ -133,12 +141,16 @@ module AllegroGraph
133
141
  private
134
142
 
135
143
  def initialize_headers
144
+ @headers["Accept"] = "application/json"
145
+ end
146
+
147
+ def initialize_request
148
+ super
136
149
  if @auth_type == :basic
137
- @headers["Authorization"] = "Basic " + Base64.encode64("#{@username}:#{@password}")
150
+ @request.basic_auth @username, @password
138
151
  elsif !@auth_type.nil?
139
152
  raise NotImplementedError, "the given auth_type [#{@auth_type}] is not implemented"
140
153
  end
141
- @headers["Accept"] = "application/json"
142
154
  end
143
155
 
144
156
  def initialize_request_body
@@ -262,11 +262,10 @@ describe "integration" do
262
262
  end
263
263
 
264
264
  it "should find objects inside that polygon" do
265
- pending
266
265
  result = @statements.find_inside_polygon :type => @type,
267
266
  :predicate => "\"at\"",
268
267
  :polygon_name => "test_polygon"
269
- result.should include([ "\"test_subject\"", "\"at\"", "\"+1+1\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/2.0/20.0/2.0/20.0/1.0>"])
268
+ result.should include([ "\"test_subject\"", "\"at\"", "\"+0.9999999776482582+0.9999999776482582\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/-100.0/100.0/-100.0/100.0/1.0>"])
270
269
  end
271
270
 
272
271
  end
@@ -84,9 +84,7 @@ describe AllegroGraph::ExtendedTransport do
84
84
  end
85
85
 
86
86
  it "should initialize the correct request object" do
87
- Net::HTTP::Get.should_receive(:new).with(
88
- "/", { "Authorization" => "Basic dGVzdDp0ZXN0\n", "Accept" => "application/json" }
89
- ).and_return(@request)
87
+ Net::HTTP::Get.should_receive(:new).with("/", { "Accept" => "application/json" }).and_return(@request)
90
88
  do_request
91
89
  end
92
90
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agraph
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
8
  - 0
9
- - beta2
10
- version: 0.1.0.beta2
9
+ version: 0.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Philipp Bruell
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-03-30 00:00:00 +02:00
17
+ date: 2010-04-05 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -77,13 +76,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
76
  version: "0"
78
77
  required_rubygems_version: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - ">"
79
+ - - ">="
81
80
  - !ruby/object:Gem::Version
82
81
  segments:
83
- - 1
84
- - 3
85
- - 1
86
- version: 1.3.1
82
+ - 0
83
+ version: "0"
87
84
  requirements: []
88
85
 
89
86
  rubyforge_project: agraph