geocaching 0.4.1 → 0.5.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/Rakefile +1 -1
- data/geocaching.gemspec +1 -1
- data/lib/geocaching/cache.rb +11 -0
- data/lib/geocaching/http.rb +1 -1
- data/lib/geocaching/version.rb +1 -1
- data/spec/log/disable.rb +5 -5
- data/spec/log/disable.txt +4 -2
- metadata +7 -5
data/Rakefile
CHANGED
data/geocaching.gemspec
CHANGED
data/lib/geocaching/cache.rb
CHANGED
@@ -358,6 +358,17 @@ module Geocaching
|
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
361
|
+
# Return whether the cache is unpublished or not.
|
362
|
+
#
|
363
|
+
# @return [Boolean] Is cache unpublished?
|
364
|
+
# @raise [Geocaching::NotFetchedError] Need to call {#fetch} first
|
365
|
+
def unpublished?
|
366
|
+
@is_unpublished ||= begin
|
367
|
+
raise NotFetchedError unless fetched?
|
368
|
+
!!(@data =~ /<h2>Cache is Unpublished<\/h2>/)
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
361
372
|
# Return whether the cache has been archived or not.
|
362
373
|
#
|
363
374
|
# @return [Boolean] Has cache been archived?
|
data/lib/geocaching/http.rb
CHANGED
@@ -69,7 +69,7 @@ module Geocaching
|
|
69
69
|
#
|
70
70
|
# @return [String] The converted string
|
71
71
|
def unescape(str)
|
72
|
-
str = str.force_encoding("UTF-8")
|
72
|
+
str = str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
73
73
|
str = str.gsub(/&#(\d{3});/) { [$1.to_i].pack("U") }
|
74
74
|
CGI.unescapeHTML(str)
|
75
75
|
end
|
data/lib/geocaching/version.rb
CHANGED
data/spec/log/disable.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
describe "Geocaching::Log for
|
3
|
+
describe "Geocaching::Log for 83a3f4f4-7faf-414a-8145-8f334622d20f (Disable Listing)" do
|
4
4
|
before :all do
|
5
|
-
@log = Geocaching::Log.fetch(:guid => "
|
5
|
+
@log = Geocaching::Log.fetch(:guid => "83a3f4f4-7faf-414a-8145-8f334622d20f")
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should return the correct username" do
|
9
|
-
@log.username.should == "
|
9
|
+
@log.username.should == "CacheHasen"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return the correct cache GUID" do
|
13
|
-
@log.cache.guid.should == "
|
13
|
+
@log.cache.guid.should == "65f58a1c-916b-4b32-a656-e80964b6819b"
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should return the correct type" do
|
@@ -18,7 +18,7 @@ describe "Geocaching::Log for 1758e5da-b49f-4a0a-b435-d12cd8d66e86 (Disable List
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should return the correct date" do
|
21
|
-
@log.date.should == Time.mktime(2010,
|
21
|
+
@log.date.should == Time.mktime(2010, 3, 13)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return the correct message" do
|
data/spec/log/disable.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
-
|
1
|
+
Es schaut so als ob die Dose nicht lange sicher war in ihrem Versteck. Bis wir das überprüft und gegebenenfalls ein neues Versteck gefunden habe, deaktiviere ich mal den Cache.
|
2
2
|
|
3
|
-
|
3
|
+
PS: Jeder der uns die errechneten (richtigen) Koordinaten schickt, darf trotzdem loggen.
|
4
|
+
|
5
|
+
[This entry was edited by pevo117 on Tuesday, March 16, 2010 at 4:09:34 AM.]
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.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-
|
17
|
+
date: 2010-10-16 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -41,8 +41,10 @@ dependencies:
|
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
segments:
|
44
|
+
- 2
|
45
|
+
- 0
|
44
46
|
- 0
|
45
|
-
version:
|
47
|
+
version: 2.0.0
|
46
48
|
type: :development
|
47
49
|
version_requirements: *id002
|
48
50
|
description: A Ruby library that provides an API for geocaching.com
|