foursquare 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History +7 -1
- data/README.rdoc +53 -1
- data/Rakefile +4 -7
- data/lib/foursquare.rb +13 -15
- metadata +3 -6
- data/LICENSE +0 -20
- data/examples/fq_test_script.rb +0 -7
data/History
CHANGED
data/README.rdoc
CHANGED
@@ -1,3 +1,55 @@
|
|
1
1
|
== foursquare
|
2
2
|
|
3
|
-
A
|
3
|
+
A simple Ruby Gem wrapper for the Foursquare API.
|
4
|
+
|
5
|
+
== install
|
6
|
+
|
7
|
+
gem install foursquare
|
8
|
+
|
9
|
+
== example
|
10
|
+
|
11
|
+
require 'rubygems'
|
12
|
+
require 'foursquare'
|
13
|
+
|
14
|
+
fq = Foursquare.new('username_or_phone','password')
|
15
|
+
|
16
|
+
fq.test
|
17
|
+
fq.cities
|
18
|
+
fq.venues(lat,long,radius,limit,query)
|
19
|
+
fq.tips(lat,long,limit)
|
20
|
+
fq.check_city(lat, long)
|
21
|
+
fq.switch_city(city_id)
|
22
|
+
fq.friend_checkins
|
23
|
+
fq.checkin(vid,venue,shout,private_checkin,tweetThis,geolat,geolong)
|
24
|
+
fq.history(limit)
|
25
|
+
fq.user_details(user_id,badges,mayor)
|
26
|
+
fq.friends
|
27
|
+
fq.venue_details(venue_id)
|
28
|
+
fq.add_venue(city_id,name,address,cross_street,city,state,zip,phone)
|
29
|
+
fq.add_tip(venue_id,text,type)
|
30
|
+
|
31
|
+
|
32
|
+
== license
|
33
|
+
|
34
|
+
(the MIT license)
|
35
|
+
|
36
|
+
Copyright (c) 2009 Workperch Inc
|
37
|
+
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
39
|
+
a copy of this software and associated documentation files (the
|
40
|
+
"Software"), to deal in the Software without restriction, including
|
41
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
42
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
43
|
+
permit persons to whom the Software is furnished to do so, subject to
|
44
|
+
the following conditions:
|
45
|
+
|
46
|
+
The above copyright notice and this permission notice shall be
|
47
|
+
included in all copies or substantial portions of the Software.
|
48
|
+
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
50
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
51
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
52
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
53
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
54
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
55
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -6,22 +6,19 @@ require 'spec/rake/spectask'
|
|
6
6
|
|
7
7
|
spec = Gem::Specification.new do |s|
|
8
8
|
s.name = "foursquare"
|
9
|
-
s.version = "0.0
|
9
|
+
s.version = "0.1.0"
|
10
10
|
s.author = "Jeremy Welch"
|
11
11
|
s.email = "hello@jeremyrwelch.com"
|
12
|
-
s.homepage = "http://
|
12
|
+
s.homepage = "http://foursquare.rubyforge.org"
|
13
13
|
s.description = s.summary = "A simple Ruby wrapper for the Foursquare API"
|
14
14
|
|
15
15
|
s.platform = Gem::Platform::RUBY
|
16
16
|
s.has_rdoc = true
|
17
|
-
s.extra_rdoc_files = ["README.rdoc", "
|
18
|
-
|
19
|
-
# Uncomment this to add a dependency
|
20
|
-
# s.add_dependency "foo"
|
17
|
+
s.extra_rdoc_files = ["README.rdoc", "History"]
|
21
18
|
|
22
19
|
s.require_path = 'lib'
|
23
20
|
s.autorequire = 'foursquare'
|
24
|
-
s.files = %w(
|
21
|
+
s.files = %w(README.rdoc Rakefile History) + Dir.glob("{lib,spec,script,examples}/**/*")
|
25
22
|
|
26
23
|
s.add_dependency('httparty', '0.4.3')
|
27
24
|
end
|
data/lib/foursquare.rb
CHANGED
@@ -6,9 +6,10 @@ class Foursquare
|
|
6
6
|
include HTTParty
|
7
7
|
base_uri 'api.foursquare.com'
|
8
8
|
format :xml
|
9
|
+
|
9
10
|
|
10
11
|
# auth user
|
11
|
-
def initialize(user,pass)
|
12
|
+
def initialize(user="",pass="")
|
12
13
|
self.class.basic_auth user, pass
|
13
14
|
end
|
14
15
|
|
@@ -18,23 +19,23 @@ class Foursquare
|
|
18
19
|
self.class.get("/v1/test")
|
19
20
|
end
|
20
21
|
|
21
|
-
#
|
22
|
+
# no auth required
|
22
23
|
def cities
|
23
24
|
self.class.get("/v1/cities")
|
24
25
|
end
|
25
26
|
|
26
|
-
def venues(
|
27
|
-
self.class.get("/v1/venues?geolat=#{
|
27
|
+
def venues(geolat,geolong,radius="",limit="",query="")
|
28
|
+
self.class.get("/v1/venues?geolat=#{geolat}&geolong=#{geolong}&r=#{radius}&l=#{limit}&q=#{query}")
|
28
29
|
end
|
29
30
|
|
30
|
-
def tips(
|
31
|
-
self.class.get("/v1/tips?geolat=#{
|
31
|
+
def tips(geolat,geolong,limit="")
|
32
|
+
self.class.get("/v1/tips?geolat=#{geolat}&geolong=#{geolong}&l=#{limit}")
|
32
33
|
end
|
33
34
|
|
34
35
|
|
35
|
-
#
|
36
|
-
def check_city(
|
37
|
-
self.class.get("/v1/checkcity?geolat=#{
|
36
|
+
# auth required
|
37
|
+
def check_city(geolat, geolong)
|
38
|
+
self.class.get("/v1/checkcity?geolat=#{geolat}&geolong=#{geolong}")
|
38
39
|
end
|
39
40
|
|
40
41
|
def switch_city(city_id)
|
@@ -49,11 +50,11 @@ class Foursquare
|
|
49
50
|
self.class.get("/v1/checkin?vid=#{vid}&venue=#{venue}&shout=#{shout}&private=#{private_checkin}&twitter=#{tweetThis}&geolat=#{geolat}&geolong=#{geolong}")
|
50
51
|
end
|
51
52
|
|
52
|
-
def history(limit)
|
53
|
+
def history(limit="10")
|
53
54
|
self.class.get("/v1/history?l=#{limit}")
|
54
55
|
end
|
55
56
|
|
56
|
-
def user_details(user_id,badges,mayor)
|
57
|
+
def user_details(user_id,badges="0",mayor="0")
|
57
58
|
self.class.get("/v1/user?uid=#{user_id}&badges=#{badges}&mayor=#{mayor}")
|
58
59
|
end
|
59
60
|
|
@@ -65,7 +66,7 @@ class Foursquare
|
|
65
66
|
self.class.get("/v1/venue?vid=#{venue_id}")
|
66
67
|
end
|
67
68
|
|
68
|
-
def add_venue(city_id,name,address,cross_street,city,state,zip=
|
69
|
+
def add_venue(city_id,name,address,cross_street,city,state,zip="",phone="")
|
69
70
|
self.class.post("/v1/addvenue", :body => {:name => name, :address => address, :crossstreet => cross_street, :city => city, :state => state, :zip => zip, :cityid => city_id, :phone => phone})
|
70
71
|
end
|
71
72
|
|
@@ -74,6 +75,3 @@ class Foursquare
|
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
77
|
-
|
78
|
-
|
79
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foursquare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Welch
|
@@ -9,7 +9,7 @@ autorequire: foursquare
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-08 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,10 +30,8 @@ extensions: []
|
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- README.rdoc
|
33
|
-
- LICENSE
|
34
33
|
- History
|
35
34
|
files:
|
36
|
-
- LICENSE
|
37
35
|
- README.rdoc
|
38
36
|
- Rakefile
|
39
37
|
- History
|
@@ -42,9 +40,8 @@ files:
|
|
42
40
|
- spec/spec_helper.rb
|
43
41
|
- script/destroy
|
44
42
|
- script/generate
|
45
|
-
- examples/fq_test_script.rb
|
46
43
|
has_rdoc: true
|
47
|
-
homepage: http://
|
44
|
+
homepage: http://foursquare.rubyforge.org
|
48
45
|
licenses: []
|
49
46
|
|
50
47
|
post_install_message:
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Workperch Inc
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|