geocaching 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/geocaching.rb +1 -1
- data/lib/geocaching/errors.rb +9 -2
- data/lib/geocaching/session.rb +2 -1
- data/lib/geocaching/session/caches.rb +4 -2
- metadata +2 -2
data/lib/geocaching.rb
CHANGED
data/lib/geocaching/errors.rb
CHANGED
@@ -4,16 +4,23 @@ module Geocaching
|
|
4
4
|
class Error < Exception; end
|
5
5
|
class HTTPError < Error; end
|
6
6
|
class ParseError < Error; end
|
7
|
+
class TimeoutError < Error; end
|
7
8
|
|
8
|
-
class
|
9
|
+
class CacheNotPublished < Error
|
9
10
|
def initialize
|
10
11
|
super "The geocache hasn't been published yet"
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
class
|
15
|
+
class CacheNotAvailable < Error
|
15
16
|
def initialize
|
16
17
|
super "The geocache is currently unavailable for viewing"
|
17
18
|
end
|
18
19
|
end
|
20
|
+
|
21
|
+
class CacheNotFound < Error
|
22
|
+
def initialize
|
23
|
+
super "The geocache code provided is not in the system."
|
24
|
+
end
|
25
|
+
end
|
19
26
|
end
|
data/lib/geocaching/session.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
-
require "net/
|
4
|
+
require "net/https"
|
5
5
|
require "nokogiri"
|
6
6
|
|
7
7
|
require "geocaching/session/caches"
|
@@ -55,6 +55,7 @@ module Geocaching
|
|
55
55
|
def open
|
56
56
|
@http ||= Net::HTTP.new(API_HOST, 443)
|
57
57
|
@http.use_ssl = true
|
58
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
58
59
|
|
59
60
|
response = request("OpenSession", {
|
60
61
|
"userName" => @username,
|
@@ -21,9 +21,11 @@ module Geocaching
|
|
21
21
|
|
22
22
|
case response.status
|
23
23
|
when "GeocacheNotAvailable"
|
24
|
-
raise
|
24
|
+
raise CacheNotAvailable
|
25
25
|
when "GeocacheNotPublished"
|
26
|
-
raise
|
26
|
+
raise CacheNotPublished
|
27
|
+
when "GCCodeNotFound"
|
28
|
+
raise CacheNotFound
|
27
29
|
end
|
28
30
|
|
29
31
|
case schema
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: geocaching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Cyron
|
@@ -75,7 +75,7 @@ files:
|
|
75
75
|
- lib/geocaching/waypoint.rb
|
76
76
|
- lib/geocaching/waypoint_type.rb
|
77
77
|
- lib/geocaching.rb
|
78
|
-
has_rdoc:
|
78
|
+
has_rdoc: true
|
79
79
|
homepage: http://nano.github.com/ruby-geocaching
|
80
80
|
licenses: []
|
81
81
|
|