gowalla 0.1.1 → 0.1.2
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/VERSION +1 -1
- data/changelog.md +4 -0
- data/gowalla.gemspec +2 -2
- data/lib/gowalla.rb +5 -28
- data/lib/gowalla/client.rb +4 -1
- data/test/test_gowalla.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/changelog.md
CHANGED
data/gowalla.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gowalla}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wynn Netherland"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-03-03}
|
13
13
|
s.description = %q{Ruby wrapper for the Gowalla API}
|
14
14
|
s.email = %q{wynn.netherland@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/gowalla.rb
CHANGED
@@ -25,38 +25,15 @@ module Gowalla
|
|
25
25
|
# client = Gowalla::Client.new
|
26
26
|
def self.configure
|
27
27
|
yield self
|
28
|
-
|
29
|
-
Gowalla.api_key = api_key
|
30
|
-
Gowalla.username = username
|
31
|
-
Gowalla.password = password
|
32
28
|
true
|
33
29
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def self.api_key=(value)
|
40
|
-
@api_key = value
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.username
|
44
|
-
@username
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.username=(value)
|
48
|
-
@username = value
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.password
|
52
|
-
@password
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.password=(value)
|
56
|
-
@password = value
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :api_key
|
33
|
+
attr_accessor :username
|
34
|
+
attr_accessor :password
|
57
35
|
end
|
58
36
|
|
59
|
-
|
60
37
|
end
|
61
38
|
|
62
39
|
require File.join(directory, 'gowalla', 'client')
|
data/lib/gowalla/client.rb
CHANGED
@@ -4,7 +4,7 @@ module Gowalla
|
|
4
4
|
include HTTParty
|
5
5
|
format :json
|
6
6
|
base_uri "http://api.gowalla.com"
|
7
|
-
headers({'Accept' => 'application/json', "User-Agent" => 'Ruby gem'})
|
7
|
+
headers({'Accept' => 'application/json, text/javascript, application/json', "User-Agent" => 'Ruby gem'})
|
8
8
|
|
9
9
|
attr_reader :username
|
10
10
|
|
@@ -118,6 +118,9 @@ module Gowalla
|
|
118
118
|
def format_geo_options(options={})
|
119
119
|
options[:lat] = "+#{options[:lat]}" if options[:lat].to_i > 0
|
120
120
|
options[:lng] = "+#{options[:lng]}" if options[:lng].to_i > 0
|
121
|
+
if options[:sw] && options[:ne]
|
122
|
+
options[:order] ||= "checkins_count desc"
|
123
|
+
end
|
121
124
|
options
|
122
125
|
end
|
123
126
|
|
data/test/test_gowalla.rb
CHANGED
@@ -14,6 +14,12 @@ class TestGowalla < Test::Unit::TestCase
|
|
14
14
|
spots.first.name.should == 'Gnomb Bar'
|
15
15
|
spots.first.radius_meters.should == 50
|
16
16
|
end
|
17
|
+
|
18
|
+
should "Retrieve a list of spots within a specified bounds" do
|
19
|
+
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?sw=(39.25565142103586%2C%20-8.717308044433594)&nw=(39.31411296530539%2C%20-8.490715026855469)", "spots.json")
|
20
|
+
spots = @client.list_spots(:sw => "(39.25565142103586, -8.717308044433594)", :nw => "(39.31411296530539, -8.490715026855469)")
|
21
|
+
spots.first.name.should == 'Gnomb Bar'
|
22
|
+
end
|
17
23
|
|
18
24
|
should "Retrieve information about a specific spot" do
|
19
25
|
stub_get('http://pengwynn:0U812@api.gowalla.com/spots/18568', 'spot.json')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gowalla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-03 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|