geocaching 0.5.0 → 0.6.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 (49) hide show
  1. data/README.markdown +47 -21
  2. data/geocaching.gemspec +3 -0
  3. data/lib/geocaching.rb +20 -6
  4. data/lib/geocaching/cache.rb +237 -94
  5. data/lib/geocaching/cache_type.rb +17 -13
  6. data/lib/geocaching/http.rb +12 -16
  7. data/lib/geocaching/log.rb +67 -46
  8. data/lib/geocaching/log_type.rb +17 -13
  9. data/lib/geocaching/my_logs.rb +22 -16
  10. data/lib/geocaching/pocket_query.rb +213 -0
  11. data/lib/geocaching/user.rb +46 -69
  12. data/lib/geocaching/version.rb +3 -1
  13. data/lib/geocaching/watchlist.rb +106 -0
  14. data/spec/cache/ape.rb +4 -0
  15. data/spec/cache/cito.rb +4 -0
  16. data/spec/cache/earthcache.rb +4 -0
  17. data/spec/cache/event.rb +4 -0
  18. data/spec/cache/letterbox.rb +4 -0
  19. data/spec/cache/lfevent.rb +4 -0
  20. data/spec/cache/locationless.rb +4 -0
  21. data/spec/cache/megaevent.rb +4 -0
  22. data/spec/cache/multi.rb +4 -0
  23. data/spec/cache/mystery.rb +4 -0
  24. data/spec/cache/traditional.rb +4 -0
  25. data/spec/cache/virtual.rb +4 -0
  26. data/spec/cache/webcam.rb +4 -0
  27. data/spec/cache/wherigo.rb +4 -0
  28. data/spec/cache_spec.rb +7 -1
  29. data/spec/log/announcement.rb +1 -1
  30. data/spec/log/archive.rb +1 -1
  31. data/spec/log/attended.rb +1 -1
  32. data/spec/log/coords_update.rb +1 -1
  33. data/spec/log/disable.rb +1 -1
  34. data/spec/log/dnf.rb +1 -1
  35. data/spec/log/enable.rb +1 -1
  36. data/spec/log/found.rb +1 -1
  37. data/spec/log/needs_archived.rb +1 -1
  38. data/spec/log/needs_maintenance.rb +1 -1
  39. data/spec/log/note.rb +1 -1
  40. data/spec/log/owner_maintenance.rb +1 -1
  41. data/spec/log/publish.rb +1 -1
  42. data/spec/log/retract.rb +1 -1
  43. data/spec/log/reviewer_note.rb +1 -1
  44. data/spec/log/unarchive.rb +1 -1
  45. data/spec/log/webcam_photo_taken.rb +1 -1
  46. data/spec/log/will_attend.rb +1 -1
  47. data/spec/log_spec.rb +7 -1
  48. metadata +22 -6
  49. data/lib/geocaching/pq.rb +0 -72
@@ -6,7 +6,7 @@ describe "Geocaching::Log for c7f88568-9417-45c2-9906-c4f0210c7837 (Webcam Photo
6
6
  end
7
7
 
8
8
  it "should return the correct username" do
9
- @log.username.should == "123flash"
9
+ @log.user.name.should == "123flash"
10
10
  end
11
11
 
12
12
  it "should return the correct cache GUID" do
@@ -6,7 +6,7 @@ describe "Geocaching::Log for 4ef9383c-19b6-41d6-843e-31ada8abbc22 (Will Attend)
6
6
  end
7
7
 
8
8
  it "should return the correct username" do
9
- @log.username.should == "Dennis the Menace2"
9
+ @log.user.name.should == "Dennis the Menace2"
10
10
  end
11
11
 
12
12
  it "should return the correct cache GUID" do
@@ -6,7 +6,13 @@ dir = File.dirname(__FILE__)
6
6
  require "geocaching"
7
7
  require "#{dir}/helper"
8
8
 
9
- Geocaching::LogType::TYPES.to_a.map { |a| a[0].to_s }.each do |type|
9
+ if ENV["GC_LOG_TYPES"]
10
+ types = ENV["GC_LOG_TYPES"].split
11
+ else
12
+ types = Geocaching::LogType::TYPES.to_a.map { |a| a[0].to_s }
13
+ end
14
+
15
+ types.each do |type|
10
16
  begin
11
17
  require "#{dir}/log/#{type}"
12
18
  rescue LoadError
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
7
+ - 6
8
8
  - 0
9
- version: 0.5.0
9
+ version: 0.6.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-10-16 00:00:00 +02:00
17
+ date: 2010-11-28 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -33,9 +33,24 @@ dependencies:
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: rspec
36
+ name: json
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 4
46
+ - 6
47
+ version: 1.4.6
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rspec
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
39
54
  none: false
40
55
  requirements:
41
56
  - - ">="
@@ -46,7 +61,7 @@ dependencies:
46
61
  - 0
47
62
  version: 2.0.0
48
63
  type: :development
49
- version_requirements: *id002
64
+ version_requirements: *id003
50
65
  description: A Ruby library that provides an API for geocaching.com
51
66
  email: thomas@thcyron.de
52
67
  executables: []
@@ -65,9 +80,10 @@ files:
65
80
  - lib/geocaching/log.rb
66
81
  - lib/geocaching/log_type.rb
67
82
  - lib/geocaching/my_logs.rb
68
- - lib/geocaching/pq.rb
83
+ - lib/geocaching/pocket_query.rb
69
84
  - lib/geocaching/user.rb
70
85
  - lib/geocaching/version.rb
86
+ - lib/geocaching/watchlist.rb
71
87
  - lib/geocaching.rb
72
88
  - spec/cache/ape.rb
73
89
  - spec/cache/cito.rb
@@ -1,72 +0,0 @@
1
- module Geocaching
2
- class PQ
3
-
4
- # A waypoint inside a Pocket Query.
5
- class Waypoint
6
- def initialize(attributes)
7
- attributes.each do |key, value|
8
- instance_variable_set("@#{key.to_s}", value)
9
- attr_reader key
10
- end
11
- end
12
-
13
- # Return the owner as a Geocaching::User object.
14
- def owner
15
- @owner
16
- end
17
-
18
- # Return
19
- end
20
-
21
- # Create a new instance with the content of +file+.
22
- # The given file must be a GPX document.
23
- def self.from_file(file)
24
- pq = new(File.read(file))
25
- rescue Errno
26
- nil
27
- end
28
-
29
- # Create a new instance with the GPX XML data given as an argument.
30
- def initialize(xml)
31
- @doc = Nokogiri::XML(xml)
32
- end
33
-
34
- # Return the name of the Pocket Query.
35
- def name
36
- @name ||= begin
37
- @doc.xpath("/xmlns:gpx/xmlns:name").content
38
- end
39
- end
40
-
41
- # Return the bounds of the Pocket Query. The returned object is a
42
- # Hash with the following keys:
43
- #
44
- # * +:minlat+
45
- # * +:minlon+
46
- # * +:maxlat+
47
- # * +:maxlon+
48
- #
49
- def bounds
50
- @bounds ||= begin
51
- bounds = @doc.xpath("/xmlns:gpx/xmlns:bounds")
52
-
53
- {
54
- :minlat =>
55
- }
56
- end
57
- end
58
-
59
- def waypoints
60
- @waypoints ||= begin
61
- @doc.xpath("/xmlns:gpx/xmlns:wpt").map do |wpt|
62
-
63
- Waypoint.new({
64
- :latitude => wpt.to_f,
65
-
66
- :description => wpt.desc,
67
- })
68
- end
69
- end
70
- end
71
- end
72
- end