jnewland-fireeagle 0.8.0.0 → 0.8.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.
data/Manifest.txt CHANGED
@@ -7,14 +7,27 @@ README.txt
7
7
  Rakefile
8
8
  lib/fireeagle.rb
9
9
  lib/fireeagle/client.rb
10
+ lib/fireeagle/error.rb
10
11
  lib/fireeagle/location.rb
12
+ lib/fireeagle/location_hierarchy.rb
13
+ lib/fireeagle/locations.rb
11
14
  lib/fireeagle/response.rb
12
15
  lib/fireeagle/user.rb
13
16
  lib/fireeagle/version.rb
14
17
  setup.rb
15
- spec/fireeagle_location_spec.rb
16
18
  spec/fireeagle_response_spec.rb
17
19
  spec/fireeagle_spec.rb
20
+ spec/location_spec.rb
21
+ spec/locations_spec.rb
22
+ spec/responses/error.xml
23
+ spec/responses/exact_location_chunk.xml
24
+ spec/responses/location_chunk.xml
25
+ spec/responses/location_chunk_with_query.xml
26
+ spec/responses/locations_chunk.xml
27
+ spec/responses/lookup.xml
28
+ spec/responses/recent.xml
29
+ spec/responses/user.xml
30
+ spec/responses/within.xml
18
31
  spec/spec.opts
19
32
  spec/spec_helper.rb
20
33
  tasks/environment.rake
data/config/hoe.rb CHANGED
@@ -58,7 +58,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
58
58
 
59
59
  # == Optional
60
60
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
61
- p.extra_deps = [ ['oauth', '>= 0.2.1'], ['hpricot', '>= 0.6'], ['GeoRuby', '>= 1.3.2'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
61
+ p.extra_deps = [ ['oauth', '>= 0.3.1'], ['happymapper', '>= 0.2.1'], ['GeoRuby', '>= 1.3.2'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
62
 
63
63
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
64
 
@@ -1,4 +1,4 @@
1
- class FireEagle
1
+ module FireEagle
2
2
  class Client
3
3
  # TODO add access_token=() and request_token=() methods that check whether the tokens are usable
4
4
 
@@ -154,8 +154,8 @@ class FireEagle
154
154
  # * <tt>plazes_id</tt>
155
155
  def lookup(params)
156
156
  raise FireEagle::ArgumentError, "OAuth Access Token Required" unless @access_token
157
- response = get(FireEagle::LOOKUP_API_PATH + ".#{format}", :params => params)
158
- FireEagle::Response.new(response.body).locations
157
+ response = get(FireEagle::LOOKUP_API_PATH, :params => params)
158
+ FireEagle::Response.parse(response.body).locations
159
159
  end
160
160
 
161
161
  # Sets a User's current Location using using a Place ID hash or a set of Location parameters. If the User
@@ -186,15 +186,15 @@ class FireEagle
186
186
  def update(location = {})
187
187
  raise FireEagle::ArgumentError, "OAuth Access Token Required" unless @access_token
188
188
  location = sanitize_location_hash(location)
189
- response = post(FireEagle::UPDATE_API_PATH + ".#{format}", :params => location)
190
- FireEagle::Response.new(response.body)
189
+ response = post(FireEagle::UPDATE_API_PATH, :params => location)
190
+ FireEagle::Response.parse(response.body)
191
191
  end
192
192
 
193
193
  # Returns the Location of a User.
194
194
  def user
195
195
  raise FireEagle::ArgumentError, "OAuth Access Token Required" unless @access_token
196
- response = get(FireEagle::USER_API_PATH + ".#{format}")
197
- FireEagle::Response.new(response.body).users.first
196
+ response = get(FireEagle::USER_API_PATH)
197
+ FireEagle::Response.parse(response.body).users.first
198
198
  end
199
199
  alias_method :location, :user
200
200
 
@@ -209,8 +209,8 @@ class FireEagle
209
209
  def recent(time = 'now', count = 10, start = 1)
210
210
  raise FireEagle::ArgumentError, "OAuth Access Token Required" unless @access_token
211
211
  params = { :count => count, :start => start, :time => time }
212
- response = get(FireEagle::RECENT_API_PATH + ".#{format}", :params => params)
213
- FireEagle::Response.new(response.body).users
212
+ response = get(FireEagle::RECENT_API_PATH, :params => params)
213
+ FireEagle::Response.parse(response.body).users
214
214
  end
215
215
 
216
216
  # Takes a Place ID or a Location and returns a list of users of your application who are within the bounding box of that Location.
@@ -237,8 +237,8 @@ class FireEagle
237
237
  raise FireEagle::ArgumentError, "OAuth Access Token Required" unless @access_token
238
238
  location = sanitize_location_hash(location)
239
239
  params = { :count => count, :start => start }.merge(location)
240
- response = get(FireEagle::WITHIN_API_PATH + ".#{format}", :params => params)
241
- FireEagle::Response.new(response.body).users
240
+ response = get(FireEagle::WITHIN_API_PATH, :params => params)
241
+ FireEagle::Response.parse(response.body).users
242
242
  end
243
243
 
244
244
  protected
@@ -265,17 +265,17 @@ class FireEagle
265
265
  def request(method, url, options) #:nodoc:
266
266
  response = case method
267
267
  when :post
268
- access_token.request(:post, url, options[:params])
268
+ access_token.request(:post, "#{url}.#{format}", options[:params])
269
269
  when :get
270
270
  qs = options[:params].collect { |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&") if options[:params]
271
- access_token.request(:get, "#{url}?#{qs}")
271
+ access_token.request(:get, "#{url}.#{format}?#{qs}")
272
272
  else
273
273
  raise ArgumentError, "method #{method} not supported"
274
274
  end
275
275
 
276
276
  case response.code
277
+ when '404'; then raise FireEagle::FireEagleException, "Not Found"
277
278
  when '500'; then raise FireEagle::FireEagleException, "Internal Server Error"
278
- when '400'; then raise FireEagle::FireEagleException, "Method Not Implemented Yet"
279
279
  else response
280
280
  end
281
281
  end
@@ -0,0 +1,9 @@
1
+ module FireEagle
2
+ class Error
3
+ include HappyMapper
4
+
5
+ tag "err"
6
+ attribute :code, String
7
+ attribute :message, String, :tag => "msg"
8
+ end
9
+ end
@@ -1,70 +1,55 @@
1
- #Describes a location
2
- class FireEagle
3
- class Location
1
+ module FireEagle
2
+ class StringWithExactMatch < String
3
+ attr_writer :exact_match
4
4
 
5
- #Initialize a Location from an XML response
6
- def initialize(doc)
7
- doc = Hpricot(doc) unless doc.is_a?(Hpricot::Doc || Hpricot::Elem)
8
- @doc = doc
9
- end
5
+ def initialize(value = "")
6
+ node = XML::Parser.string(value).parse.root
7
+ str = super(node.content)
8
+ str.exact_match = node.attributes.to_h["exact-match"] == "true"
9
+ node = nil
10
10
 
11
- def label
12
- @label ||= @doc.at("/location/label").innerText rescue nil
11
+ str
13
12
  end
14
13
 
15
- #Level of granularity for this Location
16
- def level
17
- @level ||= @doc.at("/location/level").innerText.to_i rescue nil
18
- end
19
-
20
- #Name of the level of granularity for this Location
21
- def level_name
22
- @level_name ||= @doc.at("/location/level-name").innerText rescue nil
23
- end
24
-
25
- #Human Name for this Location
26
- def name
27
- @name ||= @doc.at("/location/name").innerText rescue nil
28
- end
29
- alias_method :to_s, :name
30
-
31
- #Unique identifier for this place. Pro-tip: This is the same place_id used by Flickr.
32
- def place_id
33
- @place_id ||= @doc.at("/location/place-id").innerText rescue nil
34
- end
35
-
36
- #Numeric unique identifier for this place.
37
- def woeid
38
- @woeid ||= @doc.at("/location/woeid").innerText rescue nil
14
+ def exact_match?
15
+ @exact_match
39
16
  end
17
+ end
40
18
 
41
- #The Time at which the User last updated in this Location
42
- def located_at
43
- @located_at ||= Time.parse(@doc.at("/location/located-at").innerText) rescue nil
44
- end
19
+ # Represents a location
20
+ class Location
21
+ include HappyMapper
22
+
23
+ tag "location"
24
+ attribute :best_guess, Boolean, :tag => "best-guess"
25
+ element :label, String
26
+ element :level, Integer
27
+ element :level_name, String, :tag => "level-name"
28
+ element :located_at, Time, :tag => "located-at"
29
+ element :name, String
30
+ element :normal_name, String, :tag => "normal-name"
31
+ element :place_id, StringWithExactMatch, :tag => "place-id", :parser => :new, :raw => true
32
+ element :query, String
33
+ element :woeid, StringWithExactMatch, :parser => :new, :raw => true
34
+
35
+ element :_box, GeoRuby::SimpleFeatures::Geometry, :tag => "box",
36
+ :namespace => "georss", :parser => :from_georss, :raw => true
37
+ element :_point, GeoRuby::SimpleFeatures::Geometry, :tag => "point",
38
+ :namespace => "georss", :parser => :from_georss, :raw => true
45
39
 
46
- #The coordinates of the lower corner of a bounding box surrounding this Location
47
- def lower_corner
48
- @georss ||= @doc.at("/location//georss:box").innerText.split.map{ |l| l.to_f } rescue nil
49
- @lower_corner ||= @georss[0..1] rescue nil
40
+ def best_guess?
41
+ best_guess == true
50
42
  end
51
43
 
52
44
  # The GeoRuby[http://georuby.rubyforge.org/] representation of this location
53
45
  def geom
54
- if @doc.at("/location//georss:box")
55
- @geo ||= GeoRuby::SimpleFeatures::Geometry.from_georss(@doc.at("/location//georss:box").to_s)
56
- elsif @doc.at("/location//georss:point")
57
- @geo ||= GeoRuby::SimpleFeatures::Geometry.from_georss(@doc.at("/location//georss:point").to_s)
58
- else
59
- return nil
60
- end
46
+ _point || _box
61
47
  end
48
+
62
49
  alias_method :geo, :geom
63
-
64
- #Is this Location FireEagle's best guess?
65
- def best_guess?
66
- @best_guess ||= @doc.at("/location").attributes["best-guess"] == "true" rescue false
67
- end
68
50
 
51
+ def to_s
52
+ name
53
+ end
69
54
  end
70
- end
55
+ end
@@ -0,0 +1,10 @@
1
+ module FireEagle
2
+ class LocationHierarchy
3
+ include HappyMapper
4
+
5
+ tag "location-hierarchy"
6
+ attribute :string, String
7
+ attribute :timezone, String
8
+ has_many :locations, Location
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ module FireEagle
2
+ class Locations
3
+ include Enumerable
4
+ include HappyMapper
5
+
6
+ tag "locations"
7
+ attribute :count, Integer
8
+ attribute :start, Integer
9
+ attribute :total, Integer
10
+ has_many :locations, Location, :single => false
11
+
12
+ def [](*args)
13
+ locations[*args]
14
+ end
15
+
16
+ alias_method :slice, :[]
17
+
18
+ def each(&block)
19
+ locations.each(&block)
20
+ end
21
+
22
+ def first
23
+ locations.first
24
+ end
25
+
26
+ def last
27
+ locations.last
28
+ end
29
+
30
+ def length
31
+ locations.length
32
+ end
33
+
34
+ alias_method :size, :length
35
+ end
36
+ end
@@ -1,31 +1,33 @@
1
- class FireEagle
1
+ module FireEagle
2
2
  class Response
3
+ include HappyMapper
3
4
 
4
- #Parses the XML response from FireEagle
5
- def initialize(doc)
6
- doc = Hpricot(doc) unless doc.is_a?(Hpricot::Doc || Hpricot::Elem)
7
- @doc = doc
8
- raise FireEagle::FireEagleException, @doc.at("/rsp/err").attributes["msg"] if !success?
9
- end
5
+ tag "rsp"
6
+ attribute :status, String, :tag => "stat"
7
+ element :querystring, String
8
+ has_one :error, Error
9
+ has_one :locations, Locations
10
+ has_many :users, User
10
11
 
11
- #does the response indicate success?
12
- def success?
13
- @doc.at("/rsp").attributes["stat"] == "ok" rescue false
12
+ def self.parse(xml, opts = {})
13
+ rsp = super(xml, opts)
14
+
15
+ raise FireEagleException, rsp.error.message if rsp.fail?
16
+
17
+ rsp
14
18
  end
15
19
 
16
- #An array of of User-specific tokens and their Location at all levels the Client can see and larger.
17
- def users
18
- @users ||= @doc.search("/rsp//user").map do |user|
19
- FireEagle::User.new(user.to_s)
20
- end
20
+ def fail?
21
+ status == "fail"
21
22
  end
22
23
 
23
- #A Location array.
24
- def locations
25
- @locations ||= @doc.search("/rsp/locations/location").map do |location|
26
- FireEagle::Location.new(location.to_s)
27
- end
24
+ # does the response indicate success?
25
+ def success?
26
+ status == "ok"
28
27
  end
29
28
 
29
+ def user
30
+ users[0]
31
+ end
30
32
  end
31
33
  end
@@ -1,37 +1,20 @@
1
- class FireEagle
1
+ module FireEagle
2
2
  class User
3
- #Parses the XML response from FireEagle.
4
- def initialize(doc)
5
- doc = Hpricot(doc) unless doc.is_a?(Hpricot::Doc || Hpricot::Elem)
6
- @doc = doc
7
- end
8
-
9
- #The User-specific token for this Client.
10
- def token
11
- @token ||= @doc.at("/user").attributes["token"] rescue nil
12
- end
3
+ include HappyMapper
13
4
 
14
- #The time at which this user was last located
15
- def located_at
16
- @located_at ||= Time.parse(@doc.at("/user").attributes["located-at"]) rescue nil
17
- end
5
+ tag "user"
6
+ attribute :located_at, Time, :tag => "located-at"
7
+ attribute :readable, Boolean
8
+ attribute :token, String
9
+ attribute :writable, Boolean
10
+ has_one :location_hierarchy, LocationHierarchy, :tag => "location-hierarchy"
18
11
 
19
- #FireEagle's "best guess" form this User's Location. This best guess is derived as the most accurate
20
- #level of the hierarchy with a timestamp in the last half an hour <b>or</b> as the most accurate
21
- #level of the hierarchy with the most recent timestamp.
22
12
  def best_guess
23
- @best_guess ||= locations.select { |location| location.best_guess? }.first rescue nil
13
+ @best_guess ||= locations.select { |loc| loc.best_guess? }.first
24
14
  end
25
15
 
26
- #An Array containing all Location granularity that the Client has been allowed to
27
- #see for the User. The Location elements returned are arranged in hierarchy order consisting of:
28
- #Country, State, County, Large Cities, Neighbourhoods/Local Area, Postal Code and exact location.
29
- #The Application should therefore be prepared to receive a response that may consist of (1) only
30
- #country, or (2) country & state or (3) country, state & county and so forth.
31
16
  def locations
32
- @locations ||= @doc.search("/user/location-hierarchy/location").map do |location|
33
- FireEagle::Location.new(location.to_s)
34
- end
17
+ location_hierarchy && location_hierarchy.locations
35
18
  end
36
19
  end
37
20
  end
@@ -1,9 +1,9 @@
1
- class FireEagle #:nodoc:
1
+ module FireEagle #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 8
5
5
  TINY = 0
6
- TEENY = 0
6
+ TEENY = 1
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, TEENY].join('.')
9
9
  end
data/lib/fireeagle.rb CHANGED
@@ -5,10 +5,18 @@ gem 'oauth', ">= 0.2.4"
5
5
  require 'oauth/helper'
6
6
  require 'oauth/client/helper'
7
7
  require 'oauth/request_proxy/net_http'
8
- require 'hpricot'
9
8
  require 'geo_ruby'
9
+ require 'happymapper'
10
10
 
11
- class FireEagle
11
+ require File.dirname(__FILE__) + '/fireeagle/client'
12
+ require File.dirname(__FILE__) + '/fireeagle/location'
13
+ require File.dirname(__FILE__) + '/fireeagle/locations'
14
+ require File.dirname(__FILE__) + '/fireeagle/location_hierarchy'
15
+ require File.dirname(__FILE__) + '/fireeagle/user'
16
+ require File.dirname(__FILE__) + '/fireeagle/error'
17
+ require File.dirname(__FILE__) + '/fireeagle/response'
18
+
19
+ module FireEagle
12
20
  API_SERVER = "https://fireeagle.yahooapis.com"
13
21
  AUTH_SERVER = "https://fireeagle.yahoo.net"
14
22
  REQUEST_TOKEN_PATH = "/oauth/request_token"
@@ -25,13 +33,10 @@ class FireEagle
25
33
  # not yet supported
26
34
  #,:geom, :upcoming_venue_id, :yahoo_local_id, :plazes_id
27
35
 
28
- class Error < RuntimeError #:nodoc:
29
- end
30
-
31
- class ArgumentError < Error #:nodoc:
36
+ class ArgumentError < StandardError #:nodoc:
32
37
  end
33
38
 
34
- class FireEagleException < Error #:nodoc:
39
+ class FireEagleException < StandardError #:nodoc:
35
40
  end
36
41
  end
37
42
 
@@ -59,8 +64,3 @@ class OAuth::Consumer
59
64
  end
60
65
  alias_method :create_http, :create_http_without_verify
61
66
  end
62
-
63
- require File.dirname(__FILE__) + '/fireeagle/client'
64
- require File.dirname(__FILE__) + '/fireeagle/location'
65
- require File.dirname(__FILE__) + '/fireeagle/user'
66
- require File.dirname(__FILE__) + '/fireeagle/response'
@@ -1,11 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- describe "FireEagle Response" do
3
+ describe FireEagle::Response do
4
4
 
5
5
  describe "user / location parsing" do
6
6
 
7
7
  before(:each) do
8
- @response = FireEagle::Response.new(XML_LOCATION_RESPONSE)
8
+ @response = FireEagle::Response.parse(XML_LOCATION_RESPONSE)
9
9
  end
10
10
 
11
11
  it "should indicate success" do
@@ -33,7 +33,7 @@ describe "FireEagle Response" do
33
33
  describe "location parsing" do
34
34
 
35
35
  before(:each) do
36
- @response = FireEagle::Response.new(XML_LOOKUP_RESPONSE)
36
+ @response = FireEagle::Response.parse(XML_LOOKUP_RESPONSE)
37
37
  end
38
38
 
39
39
  it "should indicate success" do
@@ -57,7 +57,7 @@ describe "FireEagle Response" do
57
57
  describe "error handling" do
58
58
 
59
59
  it "should raise an exception when returned xml with a status of fail" do
60
- lambda { FireEagle::Response.new(XML_ERROR_RESPONSE) }.should raise_error(FireEagle::FireEagleException)
60
+ lambda { FireEagle::Response.parse(XML_ERROR_RESPONSE) }.should raise_error(FireEagle::FireEagleException, "Something bad happened")
61
61
  end
62
62
 
63
63
  end
@@ -134,11 +134,12 @@ describe "FireEagle" do
134
134
  end
135
135
 
136
136
  describe "lookup method" do
137
-
138
137
  before(:each) do
139
- @client = FireEagle::Client.new(:consumer_key => 'key', :consumer_secret => 'sekret', :access_token => 'toke', :access_token_secret => 'sekret')
140
- @response = stub('response', :body => XML_LOOKUP_RESPONSE)
141
- @client.stub!(:request).and_return(@response)
138
+ @client = FireEagle::Client.new(:consumer_key => 'key', :consumer_secret => 'sekret', :access_token => 'toke', :access_token_secret => 'sekret')
139
+ response = stub('response', :body => XML_LOOKUP_RESPONSE)
140
+ fail_response = stub('fail response', :body => XML_FAIL_LOOKUP_RESPONSE)
141
+ @client.stub!(:request).with(:get, FireEagle::LOOKUP_API_PATH, :params => {:q => "30022"}).and_return(response)
142
+ @client.stub!(:request).with(:get, FireEagle::LOOKUP_API_PATH, :params => {:mnc => 12, :mcc => 502, :lac => 2051, :cellid => 39091}).and_return(fail_response)
142
143
  end
143
144
 
144
145
  it "should return an array of Locations" do
@@ -153,6 +154,11 @@ describe "FireEagle" do
153
154
  @client.lookup(:q => "30022").first.name.should == "Alpharetta, GA 30022"
154
155
  end
155
156
 
157
+ it "should raise an exception if the lookup failed" do
158
+ lambda {
159
+ @client.lookup(:mnc => 12, :mcc => 502, :lac => 2051, :cellid => 39091)
160
+ }.should raise_error(FireEagle::FireEagleException, "Place can't be identified.")
161
+ end
156
162
  end
157
163
 
158
164
  describe "within method" do
@@ -165,10 +171,6 @@ describe "FireEagle" do
165
171
  it "should return an array of Users" do
166
172
  @client.within(:woe => "12796255").should have(2).users
167
173
  end
168
-
169
- it "should return an array of Locations for each" do
170
- @client.within(:woe => "12796255").first.should have(5).locations
171
- end
172
174
  end
173
175
 
174
176
  describe "recent method" do
@@ -187,4 +189,37 @@ describe "FireEagle" do
187
189
  end
188
190
  end
189
191
 
192
+ describe "making a request" do
193
+ before do
194
+ @client = FireEagle::Client.new(:consumer_key => 'key', :consumer_secret => 'sekret', :access_token => 'toke', :access_token_secret => 'sekret')
195
+ @access_token = stub('access token')
196
+ @client.stub!(:access_token).and_return(@access_token)
197
+ end
198
+
199
+ it "should not raise any exception when response is OK" do
200
+ response = stub('response', :code => '200', :body => XML_RECENT_RESPONSE)
201
+ @access_token.stub!(:request).and_return(response)
202
+ lambda { @client.recent }.should_not raise_error
203
+ end
204
+
205
+ it "should raise an exception when requesting to a resource that doesn't exist (404)" do
206
+ response = stub('response', :code => '404', :body => '')
207
+ @access_token.stub!(:request).and_return(response)
208
+ lambda { @client.recent }.should raise_error(FireEagle::FireEagleException, 'Not Found')
209
+ end
210
+
211
+ it "should raise an exception when requesting to a resource that hit an internal server error (500)" do
212
+ response = stub('response', :code => '500', :body => '')
213
+ @access_token.stub!(:request).and_return(response)
214
+ lambda { @client.recent }.should raise_error(FireEagle::FireEagleException, 'Internal Server Error')
215
+ end
216
+
217
+ it "should raise an exception when response is apart from 200, 404 and 500" do
218
+ %w{401 403 405}.each do |code|
219
+ response = stub('response', :code => code, :body => XML_ERROR_RESPONSE)
220
+ @access_token.stub!(:request).and_return(response)
221
+ lambda { @client.recent }.should raise_error(FireEagle::FireEagleException, 'Something bad happened')
222
+ end
223
+ end
224
+ end
190
225
  end
@@ -1,10 +1,10 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- describe "FireEagle Location" do
3
+ describe FireEagle::Location do
4
4
 
5
5
  before(:each) do
6
- location = Hpricot.XML(XML_LOCATION_CHUNK)
7
- @location = FireEagle::Location.new(location)
6
+ @location = FireEagle::Location.parse(responses(:location_chunk))
7
+ @location_with_query = FireEagle::Location.parse(responses(:location_chunk_with_query))
8
8
  end
9
9
 
10
10
  it "should know if this is a best guess" do
@@ -23,38 +23,56 @@ describe "FireEagle Location" do
23
23
  @location.name.should == 'Davis, CA'
24
24
  end
25
25
 
26
- it "should represent the location place id" do
26
+ it "should represent the raw name" do
27
+ @location.normal_name.should == "Davis"
28
+ end
29
+
30
+ it "should represent the location's place id" do
27
31
  @location.place_id.should == 'u4L9ZOObApTdx1q3'
28
32
  end
29
33
 
34
+ it "should represent whether the location's place id is an exact match" do
35
+ @location.place_id.should be_an_exact_match
36
+ end
37
+
38
+ it "should represent the location's WOEID" do
39
+ @location.woeid.should == "2389646"
40
+ end
41
+
42
+ it "should represent whether the location's WOEID is an exact match" do
43
+ @location.woeid.should be_an_exact_match
44
+ end
45
+
30
46
  it "should represent the location's timestamp" do
31
47
  @location.located_at.should == Time.parse("2008-01-22T14:23:11-08:00")
32
48
  end
33
49
 
50
+ it "should represent the label" do
51
+ @location.label.should == "Home of UC Davis"
52
+ end
53
+
34
54
  it "should use the name for #to_s" do
35
55
  @location.to_s.should == @location.name
36
56
  end
37
57
 
38
- describe "GeoRuby support" do
58
+ it "should represent the querystring" do
59
+ @location_with_query.query.should == "q=333%20W%20Harbor%20Dr,%20San%20Diego,%20CA"
60
+ end
39
61
 
62
+ describe "GeoRuby support" do
40
63
  it "should represent a bounding box as a GeoRuby Envelope" do
41
- location = Hpricot.XML(XML_LOCATION_CHUNK)
42
- @location = FireEagle::Location.new(location)
64
+ @location = FireEagle::Location.parse(responses(:location_chunk))
43
65
  @location.geom.should be_an_instance_of(GeoRuby::SimpleFeatures::Envelope)
44
66
  end
45
67
 
46
68
  it "should represent an exact point as a GeoRuby Point" do
47
- location = Hpricot.XML(XML_EXACT_LOCATION_CHUNK)
48
- @location = FireEagle::Location.new(location)
69
+ @location = FireEagle::Location.parse(responses(:exact_location_chunk))
49
70
  @location.geom.should be_an_instance_of(GeoRuby::SimpleFeatures::Point)
50
71
  end
51
72
 
52
73
  it "should be aliased as 'geo'" do
53
- location = Hpricot.XML(XML_EXACT_LOCATION_CHUNK)
54
- @location = FireEagle::Location.new(location)
74
+ @location = FireEagle::Location.parse(responses(:exact_location_chunk))
55
75
  @location.geo.should be_an_instance_of(GeoRuby::SimpleFeatures::Point)
56
76
  end
57
-
58
77
  end
59
-
60
- end
78
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe FireEagle::Locations do
4
+ before :each do
5
+ @instance = FireEagle::Locations.parse(responses(:locations_chunk))
6
+ end
7
+
8
+ it "should be Enumerable" do
9
+ @instance.should be_a_kind_of(Enumerable)
10
+ end
11
+
12
+ it "should have a length" do
13
+ @instance.length.should == 9
14
+ end
15
+
16
+ it "should have a size" do
17
+ @instance.size.should == 9
18
+ end
19
+
20
+ it "should be indexable" do
21
+ @instance[0].should_not be_nil
22
+ end
23
+
24
+ it "should be indexable by Range" do
25
+ @instance[0..2].length.should == 3
26
+ end
27
+
28
+ it "should be indexable by 'start' and 'length'" do
29
+ @instance[0, 2].length.should == 2
30
+ end
31
+
32
+ it "should be sliceable" do
33
+ @instance.should respond_to(:slice)
34
+ end
35
+
36
+ it "should have a first element" do
37
+ @instance.first.should == @instance[0]
38
+ end
39
+
40
+ it "should have a last element" do
41
+ @instance.last.should == @instance[-1]
42
+ end
43
+ end
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <rsp stat="fail">
3
+ <err code="11" msg="Something bad happened" />
4
+ </rsp>
@@ -0,0 +1,3 @@
1
+ <location xmlns:georss="http://www.georss.org/georss">
2
+ <georss:point>38.5351715088 -121.7948684692</georss:point>
3
+ </location>
@@ -0,0 +1,11 @@
1
+ <location best-guess="false" xmlns:georss="http://www.georss.org/georss">
2
+ <georss:box>38.5351715088 -121.7948684692 38.575668335 -121.6747894287</georss:box>
3
+ <level>3</level>
4
+ <level-name>city</level-name>
5
+ <located-at>2008-01-22T14:23:11-08:00</located-at>
6
+ <name>Davis, CA</name>
7
+ <normal-name>Davis</normal-name>
8
+ <woeid exact-match="true">2389646</woeid>
9
+ <place-id exact-match="true">u4L9ZOObApTdx1q3</place-id>
10
+ <label>Home of UC Davis</label>
11
+ </location>
@@ -0,0 +1,9 @@
1
+ <location best-guess="true" xmlns:georss="http://www.georss.org/georss">
2
+ <id>111541</id>
3
+ <georss:point>32.7093315125 -117.1650772095</georss:point>
4
+ <level>0</level>
5
+ <level-name>exact</level-name>
6
+ <located-at>2008-03-03T09:05:16-08:00</located-at>
7
+ <name>333 W Harbor Dr, San Diego, CA</name>
8
+ <query>q=333%20W%20Harbor%20Dr,%20San%20Diego,%20CA</query>
9
+ </location>
@@ -0,0 +1,38 @@
1
+ <locations start="0" total="9" count="9">
2
+ <location>
3
+ <name>Alpharetta, GA 30022</name>
4
+ <place-id>IrhZMHuYA5s1fFi4Qw</place-id>
5
+ </location>
6
+ <location>
7
+ <name>Hannover, Region Hannover, Deutschland</name>
8
+ <place-id>88Hctc2bBZlhvlwbUg</place-id>
9
+ </location>
10
+ <location>
11
+ <name>N&#238;mes, Gard, France</name>
12
+ <place-id>Sut8q82bBZkF0s1eTg</place-id>
13
+ </location>
14
+ <location>
15
+ <name>Ceggia, Venezia, Italia</name>
16
+ <place-id>s9ulRieYA5TkNK9otw</place-id>
17
+ </location>
18
+ <location>
19
+ <name>Comit&#225;n de Dom&#237;nguez, Comitan de Dominguez, M&#233;xico</name>
20
+ <place-id>.51HvYKbBZnSAeNHWw</place-id>
21
+ </location>
22
+ <location>
23
+ <name>Platanos Aitoloakarnanias, Etolia Kai Akarnania, Greece</name>
24
+ <place-id>CmfJ2H.YA5QKpS56HQ</place-id>
25
+ </location>
26
+ <location>
27
+ <name>Krak&#243;w, Krak&#243;w, Polska</name>
28
+ <place-id>9bYc0l.bA5vPTGscQg</place-id>
29
+ </location>
30
+ <location>
31
+ <name>Nakuru, Kenya</name>
32
+ <place-id>VDprypWYA5sujnZphA</place-id>
33
+ </location>
34
+ <location>
35
+ <name>Fez, Al Magreb</name>
36
+ <place-id>BxOaGgSYA5R40Nm1RA</place-id>
37
+ </location>
38
+ </locations>
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rsp stat="ok">
3
+ <querystring>q=30022</querystring>
4
+ <locations start="0" total="9" count="9">
5
+ <location>
6
+ <name>Alpharetta, GA 30022</name>
7
+ <place-id>IrhZMHuYA5s1fFi4Qw</place-id>
8
+ </location>
9
+ <location>
10
+ <name>Hannover, Region Hannover, Deutschland</name>
11
+ <place-id>88Hctc2bBZlhvlwbUg</place-id>
12
+ </location>
13
+ <location>
14
+ <name>N&#238;mes, Gard, France</name>
15
+ <place-id>Sut8q82bBZkF0s1eTg</place-id>
16
+ </location>
17
+ <location>
18
+ <name>Ceggia, Venezia, Italia</name>
19
+ <place-id>s9ulRieYA5TkNK9otw</place-id>
20
+ </location>
21
+ <location>
22
+ <name>Comit&#225;n de Dom&#237;nguez, Comitan de Dominguez, M&#233;xico</name>
23
+ <place-id>.51HvYKbBZnSAeNHWw</place-id>
24
+ </location>
25
+ <location>
26
+ <name>Platanos Aitoloakarnanias, Etolia Kai Akarnania, Greece</name>
27
+ <place-id>CmfJ2H.YA5QKpS56HQ</place-id>
28
+ </location>
29
+ <location>
30
+ <name>Krak&#243;w, Krak&#243;w, Polska</name>
31
+ <place-id>9bYc0l.bA5vPTGscQg</place-id>
32
+ </location>
33
+ <location>
34
+ <name>Nakuru, Kenya</name>
35
+ <place-id>VDprypWYA5sujnZphA</place-id>
36
+ </location>
37
+ <location>
38
+ <name>Fez, Al Magreb</name>
39
+ <place-id>BxOaGgSYA5R40Nm1RA</place-id>
40
+ </location>
41
+ </locations>
42
+ </rsp>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rsp xmlns:georss="http://www.georss.org/georss" stat="ok">
3
+ <users>
4
+ <user located-at="2008-07-31T22:31:37+12:00" token="5pyl1xip0uh6"/>
5
+ <user located-at="2008-07-31T21:49:03+12:00" token="i71yc3myixg3"/>
6
+ <user located-at="2008-07-30T21:40:54+12:00" token="q1jm8nubnpsi"/>
7
+ </users>
8
+ </rsp>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <rsp stat="ok" xmlns:georss="http://www.georss.org/georss">
3
+ <user token="16w3z6ysudxt" located-at="2008-12-09T17:14:50-08:00" readable="true" writable="true">
4
+ <location-hierarchy timezone="America/Los_Angeles">
5
+ <location best-guess="false">
6
+ <georss:box>38.5351715088 -121.7948684692 38.575668335 -121.6747894287</georss:box>
7
+ <label>Home of UC Davis</label>
8
+ <level>3</level>
9
+ <level-name>city</level-name>
10
+ <located-at>2008-01-22T14:23:11-08:00</located-at>
11
+ <name>Davis, CA</name>
12
+ <place-id>u4L9ZOObApTdx1q3</place-id>
13
+ </location>
14
+ <location best-guess="true">
15
+ <georss:box>38.3131217957 -122.4230804443 38.9261016846 -121.5012969971</georss:box>
16
+ <level>4</level>
17
+ <level-name>region</level-name>
18
+ <located-at>2008-01-22T18:45:26-08:00</located-at>
19
+ <name>Yolo County, California</name>
20
+ <place-id>YUYMh9CbBJ61mgFe</place-id>
21
+ </location>
22
+ <location best-guess="false">
23
+ <georss:box>32.5342788696 -124.4150238037 42.0093803406 -114.1308135986</georss:box>
24
+ <level>5</level>
25
+ <level-name>state</level-name>
26
+ <located-at>2008-01-22T18:45:26-08:00</located-at>
27
+ <name>California</name>
28
+ <place-id>SVrAMtCbAphCLAtP</place-id>
29
+ </location>
30
+ <location best-guess="false">
31
+ <georss:box>18.9108390808 -167.2764129639 72.8960571289 -66.6879425049</georss:box>
32
+ <level>6</level>
33
+ <level-name>country</level-name>
34
+ <located-at>2008-01-22T18:45:26-08:00</located-at>
35
+ <name>United States</name>
36
+ <place-id>4KO02SibApitvSBieQ</place-id>
37
+ </location>
38
+ </location-hierarchy>
39
+ </user>
40
+ </rsp>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rsp xmlns:georss="http://www.georss.org/georss" stat="ok">
3
+ <users>
4
+ <user located-at="2008-07-31T22:31:37+12:00" token="5pyl1xip0uh6"/>
5
+ <user located-at="2008-07-31T21:49:03+12:00" token="i71yc3myixg3"/>
6
+ </users>
7
+ </rsp>
data/spec/spec_helper.rb CHANGED
@@ -7,54 +7,18 @@ rescue LoadError
7
7
  end
8
8
  require 'time'
9
9
 
10
- XML_ERROR_RESPONSE = <<-RESPONSE
11
- <?xml version="1.0" encoding="utf-8"?>
12
- <rsp stat="fail">
13
- <err code="11" msg="Something bad happened" />
14
- </rsp>
15
- RESPONSE
10
+ module ResponseHelper
11
+ def responses(key)
12
+ File.read(File.join(File.dirname(__FILE__), "responses", "#{key}.xml"))
13
+ end
14
+ end
16
15
 
17
- XML_LOCATION_RESPONSE = <<-RESPONSE
18
- <?xml version="1.0" encoding="utf-8"?>
19
- <rsp stat="ok" xmlns:georss="http://www.georss.org/georss">
20
- <user token="16w3z6ysudxt">
21
- <location-hierarchy>
22
- <location best-guess="false">
23
- <georss:box>38.5351715088 -121.7948684692 38.575668335 -121.6747894287</georss:box>
24
- <level>3</level>
25
- <level-name>city</level-name>
26
- <located-at>2008-01-22T14:23:11-08:00</located-at>
27
- <name>Davis, CA</name>
28
- <place-id>u4L9ZOObApTdx1q3</place-id>
29
- </location>
30
- <location best-guess="true">
31
- <georss:box>38.3131217957 -122.4230804443 38.9261016846 -121.5012969971</georss:box>
32
- <level>4</level>
33
- <level-name>region</level-name>
34
- <located-at>2008-01-22T18:45:26-08:00</located-at>
35
- <name>Yolo County, California</name>
36
- <place-id>YUYMh9CbBJ61mgFe</place-id>
37
- </location>
38
- <location best-guess="false">
39
- <georss:box>32.5342788696 -124.4150238037 42.0093803406 -114.1308135986</georss:box>
40
- <level>5</level>
41
- <level-name>state</level-name>
42
- <located-at>2008-01-22T18:45:26-08:00</located-at>
43
- <name>California</name>
44
- <place-id>SVrAMtCbAphCLAtP</place-id>
45
- </location>
46
- <location best-guess="false">
47
- <georss:box>18.9108390808 -167.2764129639 72.8960571289 -66.6879425049</georss:box>
48
- <level>6</level>
49
- <level-name>country</level-name>
50
- <located-at>2008-01-22T18:45:26-08:00</located-at>
51
- <name>United States</name>
52
- <place-id>4KO02SibApitvSBieQ</place-id>
53
- </location>
54
- </location-hierarchy>
55
- </user>
56
- </rsp>
57
- RESPONSE
16
+ Spec::Runner.configure do |config|
17
+ include ResponseHelper
18
+ end
19
+
20
+ XML_ERROR_RESPONSE = File.read(File.join(File.dirname(__FILE__), "responses", "error.xml"))
21
+ XML_LOCATION_RESPONSE = File.read(File.join(File.dirname(__FILE__), "responses", "user.xml"))
58
22
 
59
23
  XML_SUCCESS_RESPONSE = <<-RESPONSE
60
24
  <?xml version="1.0" encoding="utf-8"?>
@@ -63,205 +27,17 @@ XML_SUCCESS_RESPONSE = <<-RESPONSE
63
27
  </rsp>
64
28
  RESPONSE
65
29
 
66
- XML_LOCATION_CHUNK = <<-RESPONSE
67
- <location best-guess="false">
68
- <georss:box>38.5351715088 -121.7948684692 38.575668335 -121.6747894287</georss:box>
69
- <level>3</level>
70
- <level-name>city</level-name>
71
- <located-at>2008-01-22T14:23:11-08:00</located-at>
72
- <name>Davis, CA</name>
73
- <place-id>u4L9ZOObApTdx1q3</place-id>
74
- </location>
75
- RESPONSE
30
+ XML_LOOKUP_RESPONSE = File.read(File.join(File.dirname(__FILE__), "responses", "lookup.xml"))
76
31
 
77
- XML_EXACT_LOCATION_CHUNK = <<-RESPONSE
78
- <location>
79
- <georss:point>38.5351715088 -121.7948684692</georss:box>
80
- </location>
81
- RESPONSE
82
-
83
- XML_LOOKUP_RESPONSE = <<-RESPONSE
84
- <?xml version="1.0" encoding="UTF-8"?>
85
- <rsp stat="ok">
86
- <querystring>q=30022</querystring>
87
- <locations start="0" total="9" count="9">
88
- <location>
89
- <name>Alpharetta, GA 30022</name>
90
- <place-id>IrhZMHuYA5s1fFi4Qw</place-id>
91
- </location>
92
- <location>
93
- <name>Hannover, Region Hannover, Deutschland</name>
94
- <place-id>88Hctc2bBZlhvlwbUg</place-id>
95
- </location>
96
- <location>
97
- <name>N&#238;mes, Gard, France</name>
98
- <place-id>Sut8q82bBZkF0s1eTg</place-id>
99
- </location>
100
- <location>
101
- <name>Ceggia, Venezia, Italia</name>
102
- <place-id>s9ulRieYA5TkNK9otw</place-id>
103
- </location>
104
- <location>
105
- <name>Comit&#225;n de Dom&#237;nguez, Comitan de Dominguez, M&#233;xico</name>
106
- <place-id>.51HvYKbBZnSAeNHWw</place-id>
107
- </location>
108
- <location>
109
- <name>Platanos Aitoloakarnanias, Etolia Kai Akarnania, Greece</name>
110
- <place-id>CmfJ2H.YA5QKpS56HQ</place-id>
111
- </location>
112
- <location>
113
- <name>Krak&#243;w, Krak&#243;w, Polska</name>
114
- <place-id>9bYc0l.bA5vPTGscQg</place-id>
115
- </location>
116
- <location>
117
- <name>Nakuru, Kenya</name>
118
- <place-id>VDprypWYA5sujnZphA</place-id>
119
- </location>
120
- <location>
121
- <name>Fez, Al Magreb</name>
122
- <place-id>BxOaGgSYA5R40Nm1RA</place-id>
123
- </location>
124
- </locations>
32
+ XML_FAIL_LOOKUP_RESPONSE = <<-RESPONSE
33
+ <?xml version="1.0" encoding="utf-8"?>
34
+ <rsp stat="fail">
35
+ <err msg="Place can't be identified." code="6"/>
125
36
  </rsp>
126
37
  RESPONSE
127
38
 
128
- XML_WITHIN_RESPONSE = <<-RESPONSE
129
- <?xml version="1.0" encoding="UTF-8"?>
130
- <rsp stat="ok">
131
- <users>
132
- <user token="MQdDrJgXMNJi">
133
- <location-hierarchy>
134
- <location best-guess="true">
135
- <id>111541</id>
136
- <georss:point>32.7093315125 -117.1650772095</georss:point>
137
- <level>0</level>
138
- <level-name>exact</level-name>
139
- <located-at>2008-03-03T09:05:16-08:00</located-at>
140
- <name>333 W Harbor Dr, San Diego, CA</name>
141
- </location>
142
- <location best-guess="false">
143
- <id>111551</id>
144
- <georss:box>
145
- 32.6916618347 -117.2174377441 32.744140625 -117.1458892822
146
- </georss:box>
147
- <level>1</level>
148
- <level-name>postal</level-name>
149
- <located-at>2008-03-03T09:05:16-08:00</located-at>
150
- <name>San Diego, CA 92101</name>
151
- <place-id>NpiXqwmYA5viX3K3Ew</place-id>
152
- <woeid>12796255</woeid>
153
- </location>
154
- <location best-guess="false">
155
- <id>111561</id>
156
- <georss:box>
157
- 32.5349388123 -117.2884292603 33.1128082275 -116.9142913818
158
- </georss:box>
159
- <level>3</level>
160
- <level-name>city</level-name>
161
- <located-at>2008-03-03T09:05:16-08:00</located-at>
162
- <name>San Diego, CA</name>
163
- <place-id>Nm4O.DebBZTYKUsu</place-id>
164
- <woeid>2487889</woeid>
165
- </location>
166
- <location best-guess="false">
167
- <id>111571</id>
168
- <georss:box>
169
- 32.5342788696 -124.4150238037 42.0093803406 -114.1308135986
170
- </georss:box>
171
- <level>5</level>
172
- <level-name>state</level-name>
173
- <located-at>2008-03-03T09:05:16-08:00</located-at>
174
- <name>California</name>
175
- <place-id>SVrAMtCbAphCLAtP</place-id>
176
- <woeid>2347563</woeid>
177
- </location>
178
- <location best-guess="false">
179
- <id>111581</id>
180
- <georss:box>
181
- 18.9108390808 -167.2764129639 72.8960571289 -66.6879425049
182
- </georss:box>
183
- <level>6</level>
184
- <level-name>country</level-name>
185
- <located-at>2008-03-03T09:05:16-08:00</located-at>
186
- <name>United States</name>
187
- <place-id>4KO02SibApitvSBieQ</place-id>
188
- <woeid>23424977</woeid>
189
- </location>
190
- </location-hierarchy>
191
- </user>
192
- <user token="MQdDrJgXMNJi">
193
- <location-hierarchy>
194
- <location best-guess="true">
195
- <id>111541</id>
196
- <georss:point>32.7093315125 -117.1650772095</georss:point>
197
- <level>0</level>
198
- <level-name>exact</level-name>
199
- <located-at>2008-03-03T09:05:16-08:00</located-at>
200
- <name>333 W Harbor Dr, San Diego, CA</name>
201
- </location>
202
- <location best-guess="false">
203
- <id>111551</id>
204
- <georss:box>
205
- 32.6916618347 -117.2174377441 32.744140625 -117.1458892822
206
- </georss:box>
207
- <level>1</level>
208
- <level-name>postal</level-name>
209
- <located-at>2008-03-03T09:05:16-08:00</located-at>
210
- <name>San Diego, CA 92101</name>
211
- <place-id>NpiXqwmYA5viX3K3Ew</place-id>
212
- <woeid>12796255</woeid>
213
- </location>
214
- <location best-guess="false">
215
- <id>111561</id>
216
- <georss:box>
217
- 32.5349388123 -117.2884292603 33.1128082275 -116.9142913818
218
- </georss:box>
219
- <level>3</level>
220
- <level-name>city</level-name>
221
- <located-at>2008-03-03T09:05:16-08:00</located-at>
222
- <name>San Diego, CA</name>
223
- <place-id>Nm4O.DebBZTYKUsu</place-id>
224
- <woeid>2487889</woeid>
225
- </location>
226
- <location best-guess="false">
227
- <id>111571</id>
228
- <georss:box>
229
- 32.5342788696 -124.4150238037 42.0093803406 -114.1308135986
230
- </georss:box>
231
- <level>5</level>
232
- <level-name>state</level-name>
233
- <located-at>2008-03-03T09:05:16-08:00</located-at>
234
- <name>California</name>
235
- <place-id>SVrAMtCbAphCLAtP</place-id>
236
- <woeid>2347563</woeid>
237
- </location>
238
- <location best-guess="false">
239
- <id>111581</id>
240
- <georss:box>
241
- 18.9108390808 -167.2764129639 72.8960571289 -66.6879425049
242
- </georss:box>
243
- <level>6</level>
244
- <level-name>country</level-name>
245
- <located-at>2008-03-03T09:05:16-08:00</located-at>
246
- <name>United States</name>
247
- <place-id>4KO02SibApitvSBieQ</place-id>
248
- <woeid>23424977</woeid>
249
- </location>
250
- </location-hierarchy>
251
- </user>
252
- </users>
253
- </rsp>
254
- RESPONSE
39
+ XML_WITHIN_RESPONSE = File.read(File.join(File.dirname(__FILE__), "responses", "within.xml"))
255
40
 
256
- XML_RECENT_RESPONSE = <<-RESPONSE
257
- <?xml version="1.0" encoding="UTF-8"?>
258
- <rsp xmlns:georss="http://www.georss.org/georss" stat="ok">
259
- <users>
260
- <user located-at="2008-07-31T22:31:37+12:00" token="5pyl1xip0uh6"/>
261
- <user located-at="2008-07-31T21:49:03+12:00" token="i71yc3myixg3"/>
262
- <user located-at="2008-07-30T21:40:54+12:00" token="q1jm8nubnpsi"/>
263
- </users>
264
- </rsp>
265
- RESPONSE
41
+ XML_RECENT_RESPONSE = File.read(File.join(File.dirname(__FILE__), "responses", "recent.xml"))
266
42
 
267
- require File.dirname(__FILE__) + '/../lib/fireeagle'
43
+ require File.dirname(__FILE__) + '/../lib/fireeagle'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnewland-fireeagle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.0
4
+ version: 0.8.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Newland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-29 00:00:00 -07:00
12
+ date: 2009-02-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,16 +19,16 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.2.4
22
+ version: 0.3.1
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
- name: hpricot
25
+ name: happymapper
26
26
  version_requirement:
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: "0.6"
31
+ version: 0.2.1
32
32
  version:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: GeoRuby
@@ -39,6 +39,15 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.3.2
41
41
  version:
42
+ - !ruby/object:Gem::Dependency
43
+ name: hoe
44
+ version_requirement:
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.8.0
50
+ version:
42
51
  description: Ruby wrapper for Yahoo!'s FireEagle
43
52
  email:
44
53
  - jnewland@gmail.com
@@ -61,14 +70,27 @@ files:
61
70
  - Rakefile
62
71
  - lib/fireeagle.rb
63
72
  - lib/fireeagle/client.rb
73
+ - lib/fireeagle/error.rb
64
74
  - lib/fireeagle/location.rb
75
+ - lib/fireeagle/location_hierarchy.rb
76
+ - lib/fireeagle/locations.rb
65
77
  - lib/fireeagle/response.rb
66
78
  - lib/fireeagle/user.rb
67
79
  - lib/fireeagle/version.rb
68
80
  - setup.rb
69
- - spec/fireeagle_location_spec.rb
70
81
  - spec/fireeagle_response_spec.rb
71
82
  - spec/fireeagle_spec.rb
83
+ - spec/location_spec.rb
84
+ - spec/locations_spec.rb
85
+ - spec/responses/error.xml
86
+ - spec/responses/exact_location_chunk.xml
87
+ - spec/responses/location_chunk.xml
88
+ - spec/responses/location_chunk_with_query.xml
89
+ - spec/responses/locations_chunk.xml
90
+ - spec/responses/lookup.xml
91
+ - spec/responses/recent.xml
92
+ - spec/responses/user.xml
93
+ - spec/responses/within.xml
72
94
  - spec/spec.opts
73
95
  - spec/spec_helper.rb
74
96
  - tasks/environment.rake