fireeagle 0.7.1.0 → 0.8.0.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/History.txt +4 -0
- data/lib/fireeagle/client.rb +5 -5
- data/lib/fireeagle/user.rb +5 -1
- data/lib/fireeagle/version.rb +2 -2
- data/spec/fireeagle_spec.rb +3 -3
- data/spec/spec_helper.rb +5 -97
- metadata +16 -3
data/History.txt
CHANGED
data/lib/fireeagle/client.rb
CHANGED
@@ -114,7 +114,7 @@ class FireEagle
|
|
114
114
|
"#{FireEagle::MOBILE_AUTH_URL}#{@app_id}"
|
115
115
|
end
|
116
116
|
|
117
|
-
# The URL the user must access to authorize this token.
|
117
|
+
# The URL the user must access to authorize this token. get_request_token must be called first. For use by web-based and desktop-based applications.
|
118
118
|
def authorization_url
|
119
119
|
raise FireEagle::ArgumentError, "call #get_request_token first" if @request_token.nil?
|
120
120
|
request_token.authorize_url
|
@@ -203,10 +203,10 @@ class FireEagle
|
|
203
203
|
#
|
204
204
|
# == Optional parameters:
|
205
205
|
#
|
206
|
-
# <tt>count</tt> Number of users to return per page. (default: 10)
|
207
|
-
# <tt>start</tt> The page number at which to start returning the list of users. Pages are 0-indexed, each page contains the per_page number of users. (default: 0)
|
208
206
|
# <tt>time</tt> The time to start looking at recent updates from. Value is flexible, supported forms are 'now', 'yesterday', '12:00', '13:00', '1:00pm' and '2008-03-12 12:34:56'. (default: 'now')
|
209
|
-
|
207
|
+
# <tt>count</tt> Number of users to return per page. (default: 10)
|
208
|
+
# <tt>start</tt> The page number at which to start returning the list of users.
|
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
212
|
response = get(FireEagle::RECENT_API_PATH + ".#{format}", :params => params)
|
@@ -233,7 +233,7 @@ class FireEagle
|
|
233
233
|
# * <tt>upcoming_venue_id</tt>
|
234
234
|
# * <tt>yahoo_local_id</tt>
|
235
235
|
# * <tt>plazes_id</tt>
|
236
|
-
def within(location = {}, count = 10, start =
|
236
|
+
def within(location = {}, count = 10, start = 1)
|
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)
|
data/lib/fireeagle/user.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class FireEagle
|
2
2
|
class User
|
3
|
-
|
4
3
|
#Parses the XML response from FireEagle.
|
5
4
|
def initialize(doc)
|
6
5
|
doc = Hpricot(doc) unless doc.is_a?(Hpricot::Doc || Hpricot::Elem)
|
@@ -12,6 +11,11 @@ class FireEagle
|
|
12
11
|
@token ||= @doc.at("/user").attributes["token"] rescue nil
|
13
12
|
end
|
14
13
|
|
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
|
18
|
+
|
15
19
|
#FireEagle's "best guess" form this User's Location. This best guess is derived as the most accurate
|
16
20
|
#level of the hierarchy with a timestamp in the last half an hour <b>or</b> as the most accurate
|
17
21
|
#level of the hierarchy with the most recent timestamp.
|
data/lib/fireeagle/version.rb
CHANGED
data/spec/fireeagle_spec.rb
CHANGED
@@ -179,11 +179,11 @@ describe "FireEagle" do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should return an array of Users" do
|
182
|
-
@client.recent(
|
182
|
+
@client.recent('yesterday', 3, 1).should have(3).users
|
183
183
|
end
|
184
184
|
|
185
|
-
it "should
|
186
|
-
@client.recent(
|
185
|
+
it "should have an 'located_at' timestamp for each user" do
|
186
|
+
@client.recent('yesterday', 3, 1).first.located_at.should == Time.parse('2008-07-31T22:31:37+12:00')
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,7 @@ rescue LoadError
|
|
5
5
|
gem 'rspec'
|
6
6
|
require 'spec'
|
7
7
|
end
|
8
|
+
require 'time'
|
8
9
|
|
9
10
|
XML_ERROR_RESPONSE = <<-RESPONSE
|
10
11
|
<?xml version="1.0" encoding="utf-8"?>
|
@@ -254,104 +255,11 @@ RESPONSE
|
|
254
255
|
|
255
256
|
XML_RECENT_RESPONSE = <<-RESPONSE
|
256
257
|
<?xml version="1.0" encoding="UTF-8"?>
|
257
|
-
<rsp
|
258
|
+
<rsp xmlns:georss="http://www.georss.org/georss" stat="ok">
|
258
259
|
<users>
|
259
|
-
<user token="
|
260
|
-
|
261
|
-
|
262
|
-
<id>111541</id>
|
263
|
-
<georss:point>32.7093315125 -117.1650772095</georss:point>
|
264
|
-
<level>0</level>
|
265
|
-
<level-name>exact</level-name>
|
266
|
-
<located-at>2008-03-03T09:05:16-08:00</located-at>
|
267
|
-
<name>333 W Harbor Dr, San Diego, CA</name>
|
268
|
-
</location>
|
269
|
-
<location best-guess="false">
|
270
|
-
<id>111551</id>
|
271
|
-
<georss:box>32.6916618347 -117.2174377441 32.744140625 -117.1458892822</georss:box>
|
272
|
-
<level>1</level>
|
273
|
-
<level-name>postal</level-name>
|
274
|
-
<located-at>2008-03-03T09:05:16-08:00</located-at>
|
275
|
-
<name>San Diego, CA 92101</name>
|
276
|
-
<place-id>NpiXqwmYA5viX3K3Ew</place-id>
|
277
|
-
<woeid>12796255</woeid>
|
278
|
-
</location>
|
279
|
-
<location best-guess="false">
|
280
|
-
<id>111561</id>
|
281
|
-
<georss:box>32.5349388123 -117.2884292603 33.1128082275 -116.9142913818</georss:box>
|
282
|
-
<level>3</level>
|
283
|
-
<level-name>city</level-name>
|
284
|
-
<located-at>2008-03-03T09:05:16-08:00</located-at>
|
285
|
-
<name>San Diego, CA</name>
|
286
|
-
<place-id>Nm4O.DebBZTYKUsu</place-id>
|
287
|
-
<woeid>2487889</woeid>
|
288
|
-
</location>
|
289
|
-
<location best-guess="false">
|
290
|
-
<id>111571</id>
|
291
|
-
<georss:box>32.5342788696 -124.4150238037 42.0093803406 -114.1308135986</georss:box>
|
292
|
-
<level>5</level>
|
293
|
-
<level-name>state</level-name>
|
294
|
-
<located-at>2008-03-03T09:05:16-08:00</located-at>
|
295
|
-
<name>California</name>
|
296
|
-
<place-id>SVrAMtCbAphCLAtP</place-id>
|
297
|
-
<woeid>2347563</woeid>
|
298
|
-
</location>
|
299
|
-
<location best-guess="false">
|
300
|
-
<id>111581</id>
|
301
|
-
<georss:box>18.9108390808 -167.2764129639 72.8960571289 -66.6879425049</georss:box>
|
302
|
-
<level>6</level>
|
303
|
-
<level-name>country</level-name>
|
304
|
-
<located-at>2008-03-03T09:05:16-08:00</located-at>
|
305
|
-
<name>United States</name>
|
306
|
-
<place-id>4KO02SibApitvSBieQ</place-id>
|
307
|
-
<woeid>23424977</woeid>
|
308
|
-
</location>
|
309
|
-
</location-hierarchy>
|
310
|
-
</user>
|
311
|
-
<user token="XMoZaTjZJiOQ">
|
312
|
-
<location-hierarchy>
|
313
|
-
<location best-guess="true">
|
314
|
-
<id>113221</id>
|
315
|
-
<georss:box>32.8155899048 -96.8162918091 32.8511695862 -96.7717132568</georss:box>
|
316
|
-
<level>1</level>
|
317
|
-
<level-name>postal</level-name>
|
318
|
-
<located-at>2008-03-03T10:24:24-08:00</located-at>
|
319
|
-
<name>Dallas, TX 75205</name>
|
320
|
-
<place-id>1KTPxFCYA5vlcics6A</place-id>
|
321
|
-
<woeid>12790441</woeid>
|
322
|
-
</location>
|
323
|
-
<location best-guess="false">
|
324
|
-
<id>113231</id>
|
325
|
-
<georss:box>32.6209487915 -96.9988708496 33.0258712769 -96.4660263062</georss:box>
|
326
|
-
<level>3</level>
|
327
|
-
<level-name>city</level-name>
|
328
|
-
<located-at>2008-03-03T10:24:24-08:00</located-at>
|
329
|
-
<name>Dallas, TX</name>
|
330
|
-
<place-id>bgWooz.bApRFBRNK</place-id>
|
331
|
-
<woeid>2388929</woeid>
|
332
|
-
</location>
|
333
|
-
<location best-guess="false">
|
334
|
-
<id>113241</id>
|
335
|
-
<georss:box>25.8372898102 -106.645652771 36.5006904602 -93.5079269409</georss:box>
|
336
|
-
<level>5</level>
|
337
|
-
<level-name>state</level-name>
|
338
|
-
<located-at>2008-03-03T10:24:24-08:00</located-at>
|
339
|
-
<name>Texas</name>
|
340
|
-
<place-id>b1Yi6qubApjz6jWW</place-id>
|
341
|
-
<woeid>2347602</woeid>
|
342
|
-
</location>
|
343
|
-
<location best-guess="false">
|
344
|
-
<id>113251</id>
|
345
|
-
<georss:box>18.9108390808 -167.2764129639 72.8960571289 -66.6879425049</georss:box>
|
346
|
-
<level>6</level>
|
347
|
-
<level-name>country</level-name>
|
348
|
-
<located-at>2008-03-03T10:24:24-08:00</located-at>
|
349
|
-
<name>United States</name>
|
350
|
-
<place-id>4KO02SibApitvSBieQ</place-id>
|
351
|
-
<woeid>23424977</woeid>
|
352
|
-
</location>
|
353
|
-
</location-hierarchy>
|
354
|
-
</user>
|
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"/>
|
355
263
|
</users>
|
356
264
|
</rsp>
|
357
265
|
RESPONSE
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fireeagle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Newland
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-12 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: oauth
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: hpricot
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -32,6 +34,7 @@ dependencies:
|
|
32
34
|
version:
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
36
|
name: GeoRuby
|
37
|
+
type: :runtime
|
35
38
|
version_requirement:
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
@@ -39,6 +42,16 @@ dependencies:
|
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.3.2
|
41
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.7.0
|
54
|
+
version:
|
42
55
|
description: Ruby wrapper for Yahoo!'s FireEagle
|
43
56
|
email:
|
44
57
|
- jnewland@gmail.com
|
@@ -96,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
109
|
requirements: []
|
97
110
|
|
98
111
|
rubyforge_project: fireeagle
|
99
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.2.0
|
100
113
|
signing_key:
|
101
114
|
specification_version: 2
|
102
115
|
summary: Ruby wrapper for Yahoo!'s FireEagle
|