geocaching 0.3.0 → 0.4.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.
Files changed (65) hide show
  1. data/README.markdown +6 -0
  2. data/geocaching.gemspec +3 -1
  3. data/lib/geocaching.rb +4 -1
  4. data/lib/geocaching/cache.rb +65 -21
  5. data/lib/geocaching/cache_type.rb +57 -13
  6. data/lib/geocaching/log.rb +34 -2
  7. data/lib/geocaching/log_type.rb +57 -19
  8. data/lib/geocaching/my_logs.rb +150 -0
  9. data/lib/geocaching/user.rb +251 -0
  10. data/lib/geocaching/version.rb +3 -0
  11. data/spec/cache/ape.rb +69 -0
  12. data/spec/cache/cito.rb +12 -0
  13. data/spec/cache/earthcache.rb +12 -0
  14. data/spec/cache/event.rb +12 -0
  15. data/spec/cache/letterbox.rb +12 -0
  16. data/spec/cache/lfevent.rb +12 -0
  17. data/spec/cache/locationless.rb +12 -0
  18. data/spec/cache/megaevent.rb +12 -0
  19. data/spec/cache/multi.rb +27 -15
  20. data/spec/cache/mystery.rb +12 -0
  21. data/spec/cache/traditional.rb +12 -0
  22. data/spec/cache/virtual.rb +12 -0
  23. data/spec/cache/webcam.rb +12 -0
  24. data/spec/cache/wherigo.rb +12 -0
  25. data/spec/cache_spec.rb +3 -2
  26. data/spec/log/announcement.rb +28 -0
  27. data/spec/log/announcement.txt +14 -0
  28. data/spec/log/archive.rb +28 -0
  29. data/spec/log/archive.txt +5 -0
  30. data/spec/log/attended.rb +28 -0
  31. data/spec/log/attended.txt +1 -0
  32. data/spec/log/coords_update.rb +28 -0
  33. data/spec/log/coords_update.txt +9 -0
  34. data/spec/log/disable.rb +28 -0
  35. data/spec/log/disable.txt +3 -0
  36. data/spec/log/dnf.rb +28 -0
  37. data/spec/log/dnf.txt +5 -0
  38. data/spec/log/enable.rb +28 -0
  39. data/spec/log/enable.txt +1 -0
  40. data/spec/log/found.rb +28 -0
  41. data/spec/{log_message.txt → log/found.txt} +0 -0
  42. data/spec/log/needs_archived.rb +28 -0
  43. data/spec/log/needs_archived.txt +1 -0
  44. data/spec/log/needs_maintenance.rb +28 -0
  45. data/spec/log/needs_maintenance.txt +1 -0
  46. data/spec/log/note.rb +28 -0
  47. data/spec/log/note.txt +1 -0
  48. data/spec/log/owner_maintenance.rb +28 -0
  49. data/spec/log/owner_maintenance.txt +1 -0
  50. data/spec/log/publish.rb +28 -0
  51. data/spec/log/publish.txt +1 -0
  52. data/spec/log/retract.rb +28 -0
  53. data/spec/log/retract.txt +4 -0
  54. data/spec/log/reviewer_note.rb +28 -0
  55. data/spec/log/reviewer_note.txt +3 -0
  56. data/spec/log/unarchive.rb +28 -0
  57. data/spec/log/unarchive.txt +1 -0
  58. data/spec/log/webcam_photo_taken.rb +28 -0
  59. data/spec/log/webcam_photo_taken.txt +1 -0
  60. data/spec/log/will_attend.rb +28 -0
  61. data/spec/log/will_attend.txt +1 -0
  62. data/spec/log_spec.rb +7 -17
  63. data/spec/user_spec.rb +48 -0
  64. metadata +44 -6
  65. data/lib/geocaching/mylogs.rb +0 -63
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for c52ff346-4567-4865-a230-c136843049e5 (CITO)" do
13
13
  @cache.name.should == "1. Dresdner CITO"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "GPS-Murmel, afrineo, Karrataka"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "b2fcf494-ecb8-4862-a279-03a325f6e1a1"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :cito
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for c52ff346-4567-4865-a230-c136843049e5 (CITO)" do
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for e34a5b69-51a1-4ed4-838d-e3c3cb75a35a (EarthCache
13
13
  @cache.name.should == "Kniepsand Amrum (Earthcache)"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "Ifranipop"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "4fcca7ab-b4c7-42ee-86d6-c61056a9263e"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :earthcache
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for e34a5b69-51a1-4ed4-838d-e3c3cb75a35a (EarthCache
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 6cea30b1-7279-43ac-86a8-cdfd1daeb348 (Event)" do
13
13
  @cache.name.should == "Weihnachtliches Vorglühen"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "papasid"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "80b63301-073e-4cf7-af23-2fb162915878"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :event
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 6cea30b1-7279-43ac-86a8-cdfd1daeb348 (Event)" do
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 01328a57-5a04-4e69-a1cc-ce0eeaa452f5 (Letterbox)
13
13
  @cache.name.should == "Worzeldorfer Gebirge (Letterbox)"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "numakeh (location by gsteinacher)"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "d60bf869-8cc2-4e38-a349-9423f7d65427"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :letterbox
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 01328a57-5a04-4e69-a1cc-ce0eeaa452f5 (Letterbox)
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 32512f3a-0fc2-45df-943b-af0a6f17f1fa (Lost and F
13
13
  @cache.name.should == "10 Jahre! Nürnberg, Germany"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "team-noris"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "c3d17887-2925-4ff0-9fa6-dccb86d48d3f"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :lfevent
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 32512f3a-0fc2-45df-943b-af0a6f17f1fa (Lost and F
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 9ce22167-5a8d-451c-a69b-b19d5ec4f578 (Locationle
13
13
  @cache.name.should == "die letzte ihrer art?"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "alexem+sonja+der rote elephant"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "87709ecd-09da-44d7-abc3-1ef36921f8e7"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :locationless
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 9ce22167-5a8d-451c-a69b-b19d5ec4f578 (Locationle
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for b60781d0-0933-426d-9a67-80eb855e87ef (Mega Event
13
13
  @cache.name.should == "Pinzgau 2010"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "Pinzgauer Geocacher"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "ba75bb32-16e5-473d-8fbc-e3dde88dd759"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :megaevent
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for b60781d0-0933-426d-9a67-80eb855e87ef (Mega Event
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -1,16 +1,24 @@
1
1
  # encoding: utf-8
2
2
 
3
- describe "Geocaching::Cache for 4ee2c3a1-96e3-4ce0-ad2b-094a51cb3f46 (Multi)" do
3
+ describe "Geocaching::Cache for 07cfab08-dadb-4a8f-a187-2a63404b4d3c (Multi)" do
4
4
  before :all do
5
- @cache = Geocaching::Cache.fetch(:guid => "4ee2c3a1-96e3-4ce0-ad2b-094a51cb3f46")
5
+ @cache = Geocaching::Cache.fetch(:guid => "07cfab08-dadb-4a8f-a187-2a63404b4d3c")
6
6
  end
7
7
 
8
8
  it "should return the correct GC code" do
9
- @cache.code.should == "GCKZ6J"
9
+ @cache.code.should == "GC1V1RH"
10
10
  end
11
11
 
12
12
  it "should return the correct name" do
13
- @cache.name.should == "MITTELERDE I - DUESTERWALD"
13
+ @cache.name.should == "D1 - Plan-les-Ouates - le défi"
14
+ end
15
+
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "Dizzione"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "d83598c6-5185-41b5-b4b9-b38c53bcdd2f"
14
22
  end
15
23
 
16
24
  it "should return the correct cache type" do
@@ -18,42 +26,46 @@ describe "Geocaching::Cache for 4ee2c3a1-96e3-4ce0-ad2b-094a51cb3f46 (Multi)" do
18
26
  end
19
27
 
20
28
  it "should return the correct size" do
21
- @cache.size.should == :regular
29
+ @cache.size.should == :other
22
30
  end
23
31
 
24
32
  it "should return the correct hidden date" do
25
- @cache.hidden_at.should == Time.mktime(2004, 10, 31)
33
+ @cache.hidden_at.should == Time.mktime(2009, 6, 23)
26
34
  end
27
35
 
28
36
  it "should return the correct difficulty rating" do
29
- @cache.difficulty.should == 3
37
+ @cache.difficulty.should == 2
30
38
  end
31
39
 
32
40
  it "should return the correct terrain rating" do
33
- @cache.terrain.should == 3.5
41
+ @cache.terrain.should == 1.5
34
42
  end
35
43
 
36
44
  it "should return the correct latitude" do
37
- @cache.latitude.should == 49.570583
45
+ @cache.latitude.should == 46.166233
38
46
  end
39
47
 
40
48
  it "should return the correct longitude" do
41
- @cache.longitude.should == 11.122083
49
+ @cache.longitude.should == 6.119683
42
50
  end
43
51
 
44
52
  it "should return the correct location" do
45
- @cache.location.should == "Bayern, Germany"
53
+ @cache.location.should == "Suisse romande (GE/VD/FR), Switzerland"
46
54
  end
47
55
 
48
56
  it "should return the correct number of logs" do
49
- @cache.logs.size.should == 504
57
+ @cache.logs.size.should >= 21
50
58
  end
51
59
 
52
- it "should return cache has been archived" do
53
- @cache.archived?.should == true
60
+ it "should return cache has not been archived" do
61
+ @cache.archived?.should == false
54
62
  end
55
63
 
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
59
- end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
71
+ end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 1d86cace-bada-435a-817a-f841718d7754 (Mystery)"
13
13
  @cache.name.should == "Nordstadt-Matrix"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "CachingFoX"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "9c360222-40d7-48be-8dc7-1d4fe5a2d37c"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :mystery
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 1d86cace-bada-435a-817a-f841718d7754 (Mystery)"
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 66274935-40d5-43d8-8cc3-c819e38f9dcc (Traditiona
13
13
  @cache.name.should == "Bridge Over Troubled Waters"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "Cermak"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "07eae57b-a6c2-4a8d-a1c9-667c63dccfca"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :traditional
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 66274935-40d5-43d8-8cc3-c819e38f9dcc (Traditiona
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 4e8b79e1-ffb2-4845-9c24-5ef54137a9b9 (Virtual)"
13
13
  @cache.name.should == "Buecherturm"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "cosmic bob"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "176be429-73f6-4812-99b0-aec77ee754d8"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :virtual
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 4e8b79e1-ffb2-4845-9c24-5ef54137a9b9 (Virtual)"
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 8cd0976c-42cf-40a2-ae02-ed87ad52d5b1 (Webcam)" d
13
13
  @cache.name.should == "Versteckte Kamera"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "buddler"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "aa82755c-0ee2-4b7b-8e1c-53217cd5b446"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :webcam
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 8cd0976c-42cf-40a2-ae02-ed87ad52d5b1 (Webcam)" d
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -13,6 +13,14 @@ describe "Geocaching::Cache for 6128b8a1-2ed3-48f0-9e05-a7117c5faffc (Wherigo)"
13
13
  @cache.name.should == "Pegnitztal"
14
14
  end
15
15
 
16
+ it "should return the correct displayed owner name" do
17
+ @cache.owner_display_name.should == "OLN"
18
+ end
19
+
20
+ it "should return the correct owner GUID" do
21
+ @cache.owner.guid == "969ca2db-d6ed-4e26-a83f-9cf336ff815a"
22
+ end
23
+
16
24
  it "should return the correct cache type" do
17
25
  @cache.type.to_sym.should == :wherigo
18
26
  end
@@ -56,4 +64,8 @@ describe "Geocaching::Cache for 6128b8a1-2ed3-48f0-9e05-a7117c5faffc (Wherigo)"
56
64
  it "should return cache is not PM-only" do
57
65
  @cache.pmonly?.should == false
58
66
  end
67
+
68
+ it "should return cache is not in review" do
69
+ @cache.in_review?.should == false
70
+ end
59
71
  end
@@ -1,10 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ dir = File.dirname(__FILE__)
4
5
 
5
6
  require "geocaching"
6
- require "helper"
7
+ require "#{dir}/helper"
7
8
 
8
9
  Geocaching::CacheType::TYPES.to_a.map { |a| a[0].to_s }.each do |type|
9
- require "cache/#{type}"
10
+ require "#{dir}/cache/#{type}"
10
11
  end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Geocaching::Log for 37ef1827-17a6-436c-b8a1-01f1573186f3 (Announcement)" do
4
+ before :all do
5
+ @log = Geocaching::Log.fetch(:guid => "37ef1827-17a6-436c-b8a1-01f1573186f3")
6
+ end
7
+
8
+ it "should return the correct username" do
9
+ @log.username.should == "Frank Frank"
10
+ end
11
+
12
+ it "should return the correct cache GUID" do
13
+ @log.cache.guid.should == "7fb096e6-bd69-4e48-8665-9316852960a0"
14
+ end
15
+
16
+ it "should return the correct type" do
17
+ @log.type.to_sym.should == :announcement
18
+ end
19
+
20
+ it "should return the correct date" do
21
+ @log.date.should == Time.mktime(2010, 8, 7)
22
+ end
23
+
24
+ it "should return the correct message" do
25
+ should_message = File.read(__FILE__.gsub(/rb$/, "txt"))
26
+ @log.message.should == should_message.gsub(/\r\n/, "\n")
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ Liebe Mopedcacher,
2
+
3
+ ich habe gerade die Routenplanung abgeschlossen und als GC-Tour bereitgestellt. Auf Wunsch mache ich auch noch Bookmarklisten fertig, dann bitte einfach bei mir melden.
4
+
5
+ Hier die GC-Tour für alle, die die Templer-Cache noch suchen müssen: [url=http://gctour.madd.in/?webcode=9f5baeff]gctour.madd.in/?webcode=9f5baeff[/url]
6
+
7
+ Diese GC-Tour ist für diejenigen, die schon zum Tempelritter geschlagen wurden: [url=http://gctour.madd.in/?webcode=8ae9eabd]gctour.madd.in/?webcode=8ae9eabd[/url]
8
+
9
+ Und falls es bei einer der beiden Gruppen etwas länger dauert, kann an der Mittagslokation noch eine Warteschleife geflogen werden: [url=http://gctour.madd.in/?webcode=7275a720]gctour.madd.in/?webcode=7275a720[/url]
10
+
11
+ Ich freue mich schon, euch in zwei Wochen zu dem Tempelrittern nach Polen zu (ent-)führen, und würde mich freuen, wenn sich noch der eine oder andere anschließen würde.
12
+
13
+ Schöne Grüße, Frank
14
+
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Geocaching::Log for 48a90293-e589-4690-bdcc-de0043d79b6d (Archive)" do
4
+ before :all do
5
+ @log = Geocaching::Log.fetch(:guid => "48a90293-e589-4690-bdcc-de0043d79b6d")
6
+ end
7
+
8
+ it "should return the correct username" do
9
+ @log.username.should == "jonny42"
10
+ end
11
+
12
+ it "should return the correct cache GUID" do
13
+ @log.cache.guid.should == "24edb0c6-cc83-477c-b0b9-78716d43a8dc"
14
+ end
15
+
16
+ it "should return the correct type" do
17
+ @log.type.to_sym.should == :archive
18
+ end
19
+
20
+ it "should return the correct date" do
21
+ @log.date.should == Time.mktime(2010, 7, 5)
22
+ end
23
+
24
+ it "should return the correct message" do
25
+ should_message = File.read(__FILE__.gsub(/rb$/, "txt"))
26
+ @log.message.should == should_message.gsub(/\r\n/, "\n")
27
+ end
28
+ end