geocaching 0.2.3 → 0.3.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.markdown +5 -7
- data/geocaching.gemspec +4 -4
- data/lib/geocaching/cache.rb +48 -9
- data/lib/geocaching/cache_type.rb +4 -4
- data/lib/geocaching/log_type.rb +42 -58
- data/spec/cache/ape.rb +2 -0
- data/spec/cache/cito.rb +59 -0
- data/spec/cache/earthcache.rb +59 -0
- data/spec/cache/event.rb +59 -0
- data/spec/cache/letterbox.rb +59 -0
- data/spec/cache/lfevent.rb +59 -0
- data/spec/cache/locationless.rb +59 -0
- data/spec/cache/megaevent.rb +59 -0
- data/spec/cache/multi.rb +59 -0
- data/spec/cache/mystery.rb +59 -0
- data/spec/cache/traditional.rb +59 -0
- data/spec/cache/virtual.rb +59 -0
- data/spec/cache/webcam.rb +59 -0
- data/spec/cache/wherigo.rb +59 -0
- data/spec/cache_spec.rb +2 -72
- data/spec/helper.rb +2 -0
- metadata +20 -6
data/README.markdown
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
Ruby
|
2
|
-
|
3
|
-
|
4
|
-
This Ruby library provides access to cache and log information
|
5
|
-
on geocaching.com. It works by parsing the website’s content as
|
6
|
-
Groundspeak does not offer an API yet.
|
1
|
+
Ruby API for geocaching.com
|
2
|
+
===========================
|
7
3
|
|
4
|
+
This Ruby library provides an API for geocaching.com. As Groundspeak
|
5
|
+
doesn’t offer an official API yet, this library parses the website’s
|
6
|
+
HTML code.
|
8
7
|
|
9
8
|
Example
|
10
9
|
-------
|
@@ -29,7 +28,6 @@ Example
|
|
29
28
|
Altough some cache information are available without being logged in,
|
30
29
|
most information will only be accessible after a successful login.
|
31
30
|
|
32
|
-
|
33
31
|
Tests
|
34
32
|
-----
|
35
33
|
|
data/geocaching.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "geocaching"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.3.0"
|
4
4
|
|
5
|
-
s.summary = "API for geocaching.com"
|
6
|
-
s.description = "A Ruby library that provides an API for
|
5
|
+
s.summary = "Ruby API for geocaching.com"
|
6
|
+
s.description = "A Ruby library that provides an API for geocaching.com"
|
7
7
|
|
8
8
|
s.author = "Thomas Cyron"
|
9
|
-
s.email = "
|
9
|
+
s.email = "thomas@thcyron.de"
|
10
10
|
s.homepage = "http://nano.github.com/ruby-geocaching"
|
11
11
|
|
12
12
|
s.files = %w(README.markdown Rakefile geocaching.gemspec)
|
data/lib/geocaching/cache.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require "time"
|
4
|
+
|
3
5
|
module Geocaching
|
4
6
|
# This class is subclass of Array and is used to store all logs
|
5
7
|
# that belong to a cache. It implements the {#fetch_all} method to
|
@@ -138,8 +140,13 @@ module Geocaching
|
|
138
140
|
end
|
139
141
|
end
|
140
142
|
|
143
|
+
# The cache’s type.
|
144
|
+
#
|
145
|
+
# @return [Geocaching::CacheType] Type
|
146
|
+
# @raise [Geocaching::NotFetchedError] Need to call {#fetch} first
|
147
|
+
# @raise [Geocaching::ExtractError] Could not extract cache type ID from website
|
141
148
|
def type
|
142
|
-
CacheType.for_id(type_id)
|
149
|
+
@type ||= CacheType.for_id(type_id)
|
143
150
|
end
|
144
151
|
|
145
152
|
# The cache’s name.
|
@@ -211,6 +218,24 @@ module Geocaching
|
|
211
218
|
end
|
212
219
|
end
|
213
220
|
|
221
|
+
# The date the event has been held.
|
222
|
+
#
|
223
|
+
# @return [Time] Event date
|
224
|
+
# @raise [Geocaching::NotFetchedError] Need to call {#fetch} first
|
225
|
+
# @raise [Geocaching::ExtractError] Could not extract event date from website
|
226
|
+
def event_date
|
227
|
+
@event_date ||= begin
|
228
|
+
raise NotFetchedError unless fetched?
|
229
|
+
return nil unless [:event, :megaevent, :cito, :lfevent].include?(type.to_sym)
|
230
|
+
|
231
|
+
if @data =~ /<strong>\s*?Event Date:\s*?<\/strong>\s*?\w+, (\d+) (\w+) (\d{4})/
|
232
|
+
Time.parse([$1, $2, $3].join)
|
233
|
+
else
|
234
|
+
raise ExtractError, "Could not extract event date from website"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
214
239
|
# The cache’s container size.
|
215
240
|
#
|
216
241
|
# @return [Symbol] Cache container size
|
@@ -222,7 +247,7 @@ module Geocaching
|
|
222
247
|
size = nil
|
223
248
|
|
224
249
|
if @data =~ /<img src="\/images\/icons\/container\/(.*?)\.gif" alt="Size: .*?" \/>/
|
225
|
-
size = $1.to_sym if %w(micro small regular large other not_chosen).include?($1)
|
250
|
+
size = $1.to_sym if %w(micro small regular large other not_chosen virtual).include?($1)
|
226
251
|
end
|
227
252
|
|
228
253
|
size || begin
|
@@ -239,6 +264,7 @@ module Geocaching
|
|
239
264
|
def latitude
|
240
265
|
@latitude ||= begin
|
241
266
|
raise NotFetchedError unless fetched?
|
267
|
+
return nil if type == :locationless
|
242
268
|
|
243
269
|
latitude = nil
|
244
270
|
elements = @doc.search("a#ctl00_ContentBody_lnkConversions")
|
@@ -261,6 +287,7 @@ module Geocaching
|
|
261
287
|
def longitude
|
262
288
|
@longitude ||= begin
|
263
289
|
raise NotFetchedError unless fetched?
|
290
|
+
return nil if type == :locationless
|
264
291
|
|
265
292
|
longitude = nil
|
266
293
|
elements = @doc.search("a#ctl00_ContentBody_lnkConversions")
|
@@ -283,6 +310,7 @@ module Geocaching
|
|
283
310
|
def location
|
284
311
|
@location ||= begin
|
285
312
|
raise NotFetchedError unless fetched?
|
313
|
+
return nil if type == :locationless
|
286
314
|
|
287
315
|
location = nil
|
288
316
|
elements = @doc.search("span#ctl00_ContentBody_Location")
|
@@ -333,18 +361,29 @@ module Geocaching
|
|
333
361
|
raise NotFetchedError unless fetched?
|
334
362
|
|
335
363
|
logs = LogsArray.new
|
336
|
-
|
364
|
+
tds = @doc.search("table.Table.LogsTable > tr > td")
|
337
365
|
|
338
|
-
if
|
366
|
+
if tds.size == 0
|
339
367
|
raise ExtractError, "Could not extract logs from website"
|
340
368
|
end
|
341
369
|
|
342
|
-
|
343
|
-
|
344
|
-
|
370
|
+
tds.each do |td|
|
371
|
+
strongs = td.search("strong")
|
372
|
+
next unless strongs.size > 0
|
373
|
+
|
374
|
+
imgs = strongs.first.search("img")
|
375
|
+
as = strongs.first.search("a")
|
376
|
+
|
377
|
+
unless imgs.size == 1 and as.size == 1
|
378
|
+
raise ExtractError, "Could not extract logs from website"
|
379
|
+
end
|
380
|
+
|
381
|
+
title = imgs.first["title"]
|
382
|
+
guid = as.first["href"] =~ /guid=([a-f0-9-]{36})/ ? $1 : nil
|
345
383
|
|
346
|
-
|
347
|
-
|
384
|
+
unless title and guid
|
385
|
+
raise ExtractError, "Could not extract logs from website"
|
386
|
+
end
|
348
387
|
|
349
388
|
logs << Log.new(:guid => guid, :title => title, :cache => self)
|
350
389
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Geocaching
|
2
2
|
class CacheType
|
3
|
-
|
3
|
+
TYPES = {
|
4
4
|
:traditional => [2, "Traditional Cache"],
|
5
5
|
:multi => [3, "Multi Cache"],
|
6
6
|
:mystery => [8, "Mystery Cache"],
|
@@ -8,17 +8,17 @@ module Geocaching
|
|
8
8
|
:wherigo => [1858, "Wherigo"],
|
9
9
|
:event => [6, "Event Cache"],
|
10
10
|
:megaevent => [453, "Mega Event Cache"],
|
11
|
-
:cito => [13, "Cache
|
11
|
+
:cito => [13, "Cache In Trash Out Event"],
|
12
12
|
:earthcache => [137, "EarthCache"],
|
13
13
|
:lfevent => [3653, "Lost and Found Event Cache"],
|
14
14
|
:locationless => [12, "Locationless Reverse Cache"],
|
15
15
|
:webcam => [11, "Webcam Cache"],
|
16
16
|
:virtual => [4, "Virtual Cache"],
|
17
|
-
:ape => [32, "Project A.P.E. Cache"] #
|
17
|
+
:ape => [32, "Project A.P.E. Cache"] # XXX
|
18
18
|
}
|
19
19
|
|
20
20
|
def self.for_id(id)
|
21
|
-
if info =
|
21
|
+
if info = TYPES.to_a.select { |(k,v)| v[0] == id } and info.size == 1
|
22
22
|
new(info.first)
|
23
23
|
end
|
24
24
|
end
|
data/lib/geocaching/log_type.rb
CHANGED
@@ -1,72 +1,56 @@
|
|
1
1
|
module Geocaching
|
2
2
|
class LogType
|
3
|
-
|
4
|
-
:
|
5
|
-
|
6
|
-
:dnf
|
7
|
-
:found
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
TYPES = {
|
4
|
+
:published => ["icon_greenlight", "Publish Listing"],
|
5
|
+
:retracted => ["", ""], # TODO
|
6
|
+
:dnf => ["icon_sad", "Didn't find it"],
|
7
|
+
:found => ["icon_smile", "Found it"],
|
8
|
+
:webcam_photo_taken => ["", ""], # TODO
|
9
|
+
:will_attend => ["icon_rsvp", "Will Attend"],
|
10
|
+
:announcement => ["icon_announcement", "Announcement"],
|
11
11
|
:attended => ["icon_attended", "Attended"],
|
12
|
-
|
13
|
-
:
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
:
|
19
|
-
:
|
20
|
-
|
21
|
-
|
12
|
+
:needs_maintenance => ["icon_needsmaint", "Needs Maintenance"],
|
13
|
+
:owner_maintenance => ["icon_maint", "Owner Maintenance"],
|
14
|
+
:disabled => ["icon_disabled", "Temporarily Disable Listing"],
|
15
|
+
:enabled => ["icon_enabled", "Enable Listing"],
|
16
|
+
:note => ["icon_note", "Write Note"],
|
17
|
+
:needs_archived => ["icon_remove", "Needs Archived"],
|
18
|
+
:archived => ["traffic_cone", "Archive"],
|
19
|
+
:unarchived => ["traffic_cone", "Unarchive"],
|
20
|
+
:coords_updated => ["coord_update", "Update Coordinates"],
|
21
|
+
:reviewer_note => ["big_smile", "Post Reviewer Note"]
|
22
22
|
}
|
23
23
|
|
24
24
|
def self.for_icon(icon)
|
25
|
-
|
26
|
-
|
27
|
-
when "" then CACHE_RETRACTED # TODO
|
28
|
-
when "" then DID_NOT_FOUND
|
29
|
-
when "" then FOUND
|
30
|
-
when "" then WEBCAM_PHOTO_TAKEN # TODO
|
31
|
-
when "icon_rsvp" then WILL_ATTEND
|
32
|
-
when "icon_announcement" then ANNOUNCEMENT
|
33
|
-
when "" then ATTENDED
|
34
|
-
when "icon_needsmaint" then NEEDS_MAINTENANCE
|
35
|
-
when "icon_maint" then PERFORMED_MAINTENANCE
|
36
|
-
when "icon_disabled" then CACHE_DISABLED
|
37
|
-
when "icon_enabled" then CACHE_ENABLED
|
38
|
-
when "icon_note" then NOTE
|
39
|
-
when "icon_remove" then NEEDS_ARCHIVED
|
40
|
-
when "traffic_cone" then CACHE_ARCHIVED
|
41
|
-
when "traffic_cone" then CACHE_UNARCHIVED
|
42
|
-
when "coord_update" then COORDS_UPDATED
|
43
|
-
when "big_smile" then REVIEWER_NOTE
|
44
|
-
else nil
|
25
|
+
if info = TYPES.to_a.select { |(k,v)| v[0] == icon } and info.size == 1
|
26
|
+
new(info.first)
|
45
27
|
end
|
46
28
|
end
|
47
29
|
|
48
30
|
def self.for_title(title)
|
49
|
-
|
50
|
-
|
51
|
-
when "" then CACHE_RETRACTED # TODO
|
52
|
-
when "Didn't find it" then DID_NOT_FOUND
|
53
|
-
when "Found it" then FOUND # TODO
|
54
|
-
when "" then WEBCAM_PHOTO_TAKEN
|
55
|
-
when "Will Attend" then WILL_ATTEND
|
56
|
-
when "Announcement" then ANNOUNCEMENT
|
57
|
-
when "Attended" then ATTENDED
|
58
|
-
when "Needs Maintenance" then NEEDS_MAINTENANCE
|
59
|
-
when "Owner Maintenance" then PERFORMED_MAINTENANCE
|
60
|
-
when "Temporarily Disable Listing" then CACHE_DISABLED
|
61
|
-
when "Enable Listing" then CACHE_ENABLE
|
62
|
-
when "Write note" then NOTE
|
63
|
-
when "Needs Archived" then NEEDS_ARCHIVED
|
64
|
-
when "Archive" then CACHE_ARCHIVED
|
65
|
-
when "Unarchive" then CACHE_UNARCHIVE
|
66
|
-
when "Update Coordinates" then COORDS_UPDATED
|
67
|
-
when "Post Reviewer Note" then REVIEWER_NOTE
|
68
|
-
else nil
|
31
|
+
if info = TYPES.to_a.select { |(k,v)| v[1] == title } and info.size == 1
|
32
|
+
new(info.first)
|
69
33
|
end
|
70
34
|
end
|
35
|
+
|
36
|
+
def new(info)
|
37
|
+
@info = info
|
38
|
+
end
|
39
|
+
|
40
|
+
def icon
|
41
|
+
@info[1][0]
|
42
|
+
end
|
43
|
+
|
44
|
+
def description
|
45
|
+
@info[1][1]
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_sym
|
49
|
+
@info[0]
|
50
|
+
end
|
51
|
+
|
52
|
+
def ==(s)
|
53
|
+
to_sym == s
|
54
|
+
end
|
71
55
|
end
|
72
56
|
end
|
data/spec/cache/ape.rb
ADDED
data/spec/cache/cito.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for c52ff346-4567-4865-a230-c136843049e5 (CITO)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "c52ff346-4567-4865-a230-c136843049e5")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC1W95B"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "1. Dresdner CITO"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :cito
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct event date" do
|
25
|
+
@cache.event_date.should == Time.mktime(2010, 4, 17)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 2.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 4.5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 51.066667
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 13.728333
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Sachsen, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 337
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for e34a5b69-51a1-4ed4-838d-e3c3cb75a35a (EarthCache)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "e34a5b69-51a1-4ed4-838d-e3c3cb75a35a")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC26Y3T"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Kniepsand Amrum (Earthcache)"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :earthcache
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2010, 4, 17)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 2
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 2
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 54.64475
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 8.321667
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Schleswig-Holstein, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should >= 57
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
data/spec/cache/event.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 6cea30b1-7279-43ac-86a8-cdfd1daeb348 (Event)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "6cea30b1-7279-43ac-86a8-cdfd1daeb348")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC211KT"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Weihnachtliches Vorglühen"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :event
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct event date" do
|
25
|
+
@cache.event_date.should == Time.mktime(2009, 12, 23)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 1
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.420667
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.1145
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should == 69
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 01328a57-5a04-4e69-a1cc-ce0eeaa452f5 (Letterbox)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "01328a57-5a04-4e69-a1cc-ce0eeaa452f5")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC1KBJD"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Worzeldorfer Gebirge (Letterbox)"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :letterbox
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :regular
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2009, 1, 3)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 3
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 3
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.370417
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.116
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should >= 100
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 32512f3a-0fc2-45df-943b-af0a6f17f1fa (Lost and Found Event)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "32512f3a-0fc2-45df-943b-af0a6f17f1fa")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC2546Y"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "10 Jahre! Nürnberg, Germany"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :lfevent
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct event date" do
|
25
|
+
@cache.event_date.should == Time.mktime(2010, 5, 1)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 2
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.35475
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.20695
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should == 118
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 9ce22167-5a8d-451c-a69b-b19d5ec4f578 (Locationless)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "9ce22167-5a8d-451c-a69b-b19d5ec4f578")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GCB48F"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "die letzte ihrer art?"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :locationless
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :virtual
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2002, 12, 14)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 2.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 2.5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return no latitude" do
|
37
|
+
@cache.latitude.should == nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return no longitude" do
|
41
|
+
@cache.longitude.should == nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return no location" do
|
45
|
+
@cache.location.should == nil
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should == 1330
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for b60781d0-0933-426d-9a67-80eb855e87ef (Mega Event)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "b60781d0-0933-426d-9a67-80eb855e87ef")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC1XEDZ"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Pinzgau 2010"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :megaevent
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct event date" do
|
25
|
+
@cache.event_date.should == Time.mktime(2010, 5, 29)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 1
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 47.2744
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 12.770883
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Salzburg, Austria"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 1783
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
data/spec/cache/multi.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 4ee2c3a1-96e3-4ce0-ad2b-094a51cb3f46 (Multi)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "4ee2c3a1-96e3-4ce0-ad2b-094a51cb3f46")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GCKZ6J"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "MITTELERDE I - DUESTERWALD"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :multi
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :regular
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2004, 10, 31)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 3
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 3.5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.570583
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.122083
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should == 504
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 1d86cace-bada-435a-817a-f841718d7754 (Mystery)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "1d86cace-bada-435a-817a-f841718d7754")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC21BBB"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Nordstadt-Matrix"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :mystery
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :small
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2010, 2, 23)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 3.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 2
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.466133
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.07135
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 61
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 66274935-40d5-43d8-8cc3-c819e38f9dcc (Traditional)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "66274935-40d5-43d8-8cc3-c819e38f9dcc")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GCF00"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Bridge Over Troubled Waters"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :traditional
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :regular
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2001, 07, 05)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 2.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1.5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 32.6684
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == -97.436783
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Texas, United States"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 230
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 4e8b79e1-ffb2-4845-9c24-5ef54137a9b9 (Virtual)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "4e8b79e1-ffb2-4845-9c24-5ef54137a9b9")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GCEB74"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Buecherturm"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :virtual
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :virtual
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2003, 3, 24)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 3
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 53.553067
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 10.006933
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Hamburg, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 856
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 8cd0976c-42cf-40a2-ae02-ed87ad52d5b1 (Webcam)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "8cd0976c-42cf-40a2-ae02-ed87ad52d5b1")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GCQG38"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Versteckte Kamera"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :webcam
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :not_chosen
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2005, 9, 9)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 1.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.441
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.1065
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return the correct number of logs" do
|
49
|
+
@cache.logs.size.should == 85
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has been archived" do
|
53
|
+
@cache.archived?.should == true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Geocaching::Cache for 6128b8a1-2ed3-48f0-9e05-a7117c5faffc (Wherigo)" do
|
4
|
+
before :all do
|
5
|
+
@cache = Geocaching::Cache.fetch(:guid => "6128b8a1-2ed3-48f0-9e05-a7117c5faffc")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return the correct GC code" do
|
9
|
+
@cache.code.should == "GC19RVP"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the correct name" do
|
13
|
+
@cache.name.should == "Pegnitztal"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the correct cache type" do
|
17
|
+
@cache.type.to_sym.should == :wherigo
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return the correct size" do
|
21
|
+
@cache.size.should == :small
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return the correct hidden date" do
|
25
|
+
@cache.hidden_at.should == Time.mktime(2008, 2, 29)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the correct difficulty rating" do
|
29
|
+
@cache.difficulty.should == 1.5
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the correct terrain rating" do
|
33
|
+
@cache.terrain.should == 1.5
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the correct latitude" do
|
37
|
+
@cache.latitude.should == 49.466333
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the correct longitude" do
|
41
|
+
@cache.longitude.should == 11.147267
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the correct location" do
|
45
|
+
@cache.location.should == "Bayern, Germany"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return a plausible number of logs" do
|
49
|
+
@cache.logs.size.should >= 182
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return cache has not been archived" do
|
53
|
+
@cache.archived?.should == false
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return cache is not PM-only" do
|
57
|
+
@cache.pmonly?.should == false
|
58
|
+
end
|
59
|
+
end
|
data/spec/cache_spec.rb
CHANGED
@@ -5,76 +5,6 @@ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
|
5
5
|
require "geocaching"
|
6
6
|
require "helper"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
@cache.code.should == "GCF00"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should return the correct GUID" do
|
14
|
-
@cache.guid.should == "66274935-40d5-43d8-8cc3-c819e38f9dcc"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return correct cache type ID" do
|
18
|
-
@cache.type_id.should == 2
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return the correct name" do
|
22
|
-
@cache.name.should == "Bridge Over Troubled Waters"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should return the correct latitude" do
|
26
|
-
@cache.latitude.should == 32.6684
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return the correct longitude" do
|
30
|
-
@cache.longitude.should == -97.436783
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should return the correct difficulty rating" do
|
34
|
-
@cache.difficulty.should == 2.5
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should return the correct terrain rating" do
|
38
|
-
@cache.terrain.should == 1.5
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should return the correct hidden at date" do
|
42
|
-
@cache.hidden_at.should == Time.mktime(2001, 07, 05)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return the correct location" do
|
46
|
-
@cache.location.should == "Texas, United States"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should say cache is not archived" do
|
50
|
-
@cache.archived?.should == false
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should say cache is not PM-only" do
|
54
|
-
@cache.pmonly?.should == false
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should return a plausible number of total logs" do
|
58
|
-
@cache.logs.size.should >= 230
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should return the correct type" do
|
62
|
-
@cache.type.to_sym.should == :traditional
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "Geocaching::Cache for GCF00" do
|
67
|
-
before :all do
|
68
|
-
@cache = Geocaching::Cache.fetch(:code => "GCF00")
|
69
|
-
end
|
70
|
-
|
71
|
-
include GCF00
|
72
|
-
end
|
73
|
-
|
74
|
-
describe "Geocaching::Cache for 66274935-40d5-43d8-8cc3-c819e38f9dcc" do
|
75
|
-
before :all do
|
76
|
-
@cache = Geocaching::Cache.fetch(:guid => "66274935-40d5-43d8-8cc3-c819e38f9dcc")
|
77
|
-
end
|
78
|
-
|
79
|
-
include GCF00
|
8
|
+
Geocaching::CacheType::TYPES.to_a.map { |a| a[0].to_s }.each do |type|
|
9
|
+
require "cache/#{type}"
|
80
10
|
end
|
data/spec/helper.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 2
|
8
7
|
- 3
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Thomas Cyron
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -45,8 +45,8 @@ dependencies:
|
|
45
45
|
version: "0"
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id002
|
48
|
-
description: A Ruby library that provides an API for
|
49
|
-
email:
|
48
|
+
description: A Ruby library that provides an API for geocaching.com
|
49
|
+
email: thomas@thcyron.de
|
50
50
|
executables: []
|
51
51
|
|
52
52
|
extensions: []
|
@@ -64,6 +64,20 @@ files:
|
|
64
64
|
- lib/geocaching/log_type.rb
|
65
65
|
- lib/geocaching/mylogs.rb
|
66
66
|
- lib/geocaching.rb
|
67
|
+
- spec/cache/ape.rb
|
68
|
+
- spec/cache/cito.rb
|
69
|
+
- spec/cache/earthcache.rb
|
70
|
+
- spec/cache/event.rb
|
71
|
+
- spec/cache/letterbox.rb
|
72
|
+
- spec/cache/lfevent.rb
|
73
|
+
- spec/cache/locationless.rb
|
74
|
+
- spec/cache/megaevent.rb
|
75
|
+
- spec/cache/multi.rb
|
76
|
+
- spec/cache/mystery.rb
|
77
|
+
- spec/cache/traditional.rb
|
78
|
+
- spec/cache/virtual.rb
|
79
|
+
- spec/cache/webcam.rb
|
80
|
+
- spec/cache/wherigo.rb
|
67
81
|
- spec/cache_spec.rb
|
68
82
|
- spec/helper.rb
|
69
83
|
- spec/log_message.txt
|
@@ -99,6 +113,6 @@ rubyforge_project:
|
|
99
113
|
rubygems_version: 1.3.7
|
100
114
|
signing_key:
|
101
115
|
specification_version: 3
|
102
|
-
summary: API for geocaching.com
|
116
|
+
summary: Ruby API for geocaching.com
|
103
117
|
test_files: []
|
104
118
|
|