foursquared 0.0.4
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/.gitignore +10 -0
- data/.rspec +2 -0
- data/Gemfile +19 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +30 -0
- data/foursquared.gemspec +34 -0
- data/lib/core_ext/symbol.rb +7 -0
- data/lib/foursquared/badges.rb +12 -0
- data/lib/foursquared/checkins.rb +89 -0
- data/lib/foursquared/client.rb +58 -0
- data/lib/foursquared/error.rb +17 -0
- data/lib/foursquared/events.rb +18 -0
- data/lib/foursquared/lists.rb +97 -0
- data/lib/foursquared/oauth/client.rb +37 -0
- data/lib/foursquared/pages.rb +49 -0
- data/lib/foursquared/photos.rb +34 -0
- data/lib/foursquared/response/badge.rb +87 -0
- data/lib/foursquared/response/badge_group.rb +42 -0
- data/lib/foursquared/response/category.rb +53 -0
- data/lib/foursquared/response/checkin.rb +180 -0
- data/lib/foursquared/response/event.rb +52 -0
- data/lib/foursquared/response/list.rb +199 -0
- data/lib/foursquared/response/list_item.rb +63 -0
- data/lib/foursquared/response/photo.rb +102 -0
- data/lib/foursquared/response/special.rb +131 -0
- data/lib/foursquared/response/tip.rb +134 -0
- data/lib/foursquared/response/user.rb +246 -0
- data/lib/foursquared/response/venue.rb +252 -0
- data/lib/foursquared/settings.rb +28 -0
- data/lib/foursquared/specials.rb +25 -0
- data/lib/foursquared/tips.rb +113 -0
- data/lib/foursquared/users.rb +206 -0
- data/lib/foursquared/venues.rb +217 -0
- data/lib/foursquared/version.rb +4 -0
- data/lib/foursquared.rb +47 -0
- data/spec/foursquared/badges_spec.rb +82 -0
- data/spec/foursquared/checkins_spec.rb +0 -0
- data/spec/foursquared/events_spec.rb +50 -0
- data/spec/foursquared/oauth/client_spec.rb +24 -0
- data/spec/foursquared/pages_spec.rb +42 -0
- data/spec/foursquared/photos_spec.rb +41 -0
- data/spec/foursquared/response/badge_spec.rb +40 -0
- data/spec/foursquared/response/category_spec.rb +48 -0
- data/spec/foursquared/response/checkin_spec.rb +100 -0
- data/spec/foursquared/response/event_category_spec.rb +48 -0
- data/spec/foursquared/response/event_spec.rb +60 -0
- data/spec/foursquared/response/list_spec.rb +56 -0
- data/spec/foursquared/response/photo_spec.rb +70 -0
- data/spec/foursquared/response/special_spec.rb +0 -0
- data/spec/foursquared/response/user_spec.rb +124 -0
- data/spec/foursquared/response/venue_spec.rb +83 -0
- data/spec/foursquared/specials_spec.rb +4 -0
- data/spec/foursquared/users_spec.rb +241 -0
- data/spec/spec_helper.rb +27 -0
- metadata +344 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/checkin'
|
3
|
+
require 'foursquared/client'
|
4
|
+
require 'pp'
|
5
|
+
describe Foursquared::Response::Checkin do
|
6
|
+
let(:checkin) do
|
7
|
+
YAML.load(%{
|
8
|
+
meta:
|
9
|
+
code: 200
|
10
|
+
response:
|
11
|
+
checkin:
|
12
|
+
id: "4d627f6814963704dc28ff94"
|
13
|
+
createdAt: 1298300776
|
14
|
+
type: "checkin"
|
15
|
+
shout: "Another one of these days. #snow"
|
16
|
+
timeZoneOffset: -300
|
17
|
+
user:
|
18
|
+
id: "32"
|
19
|
+
firstName: "Dens"
|
20
|
+
venue:
|
21
|
+
id: "408c5100f964a520c6f21ee3"
|
22
|
+
name: "Tompkins Square Park"
|
23
|
+
source:
|
24
|
+
name: "foursquare for iPhone"
|
25
|
+
url: "https://foursquare.com/download/#/iphone"
|
26
|
+
photos:
|
27
|
+
count: 1
|
28
|
+
items:
|
29
|
+
- id: "4d627f80d47328fd96bf3448"
|
30
|
+
createdAt: 1298300800
|
31
|
+
prefix: "https://irs3.4sqi.net/img/general/"
|
32
|
+
suffix: "/UBTEFRRMLYOHHX4RWHFTGQKSDMY14A1JLHURUTG5VUJ02KQ0.jpg"
|
33
|
+
likes:
|
34
|
+
count: 0
|
35
|
+
groups: []
|
36
|
+
like: false
|
37
|
+
score:
|
38
|
+
- total: 1
|
39
|
+
scores:
|
40
|
+
- points: 1
|
41
|
+
icon: "https://foursquare.com/img/points/defaultpointsicon2.png"
|
42
|
+
message: "Every check-in counts!"
|
43
|
+
}
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:likes) do
|
48
|
+
YAML.load(%{
|
49
|
+
meta:
|
50
|
+
code: 200
|
51
|
+
response:
|
52
|
+
likes:
|
53
|
+
count: 42
|
54
|
+
groups:
|
55
|
+
- type: "others"
|
56
|
+
count: 42
|
57
|
+
items:
|
58
|
+
- id: "141623"
|
59
|
+
firstName: "chad"
|
60
|
+
lastName: "g."
|
61
|
+
photo:
|
62
|
+
prefix: "https://irs2.4sqi.net/img/user/"
|
63
|
+
suffix: "/X521V5IIEPN2Y3F5.jpg"
|
64
|
+
- id: "16066"
|
65
|
+
firstName: "Allan"
|
66
|
+
lastName: "B."
|
67
|
+
}
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
subject { foursquared_test_client.checkin("4d627f6814963704dc28ff94") }
|
72
|
+
|
73
|
+
before :each do
|
74
|
+
|
75
|
+
stub_request(:get, "https://api.foursquare.com/v2/checkins/4d627f6814963704dc28ff94?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
76
|
+
to_return(:status => 200, :body => checkin.to_json, :headers => {})
|
77
|
+
stub_request(:get, "https://api.foursquare.com/v2/checkins/4d627f6814963704dc28ff94/likes?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
78
|
+
to_return(:status => 200, :body => likes.to_json, :headers => {})
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should get checkin id" do
|
82
|
+
subject.id.should == "4d627f6814963704dc28ff94"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should get the checkin venue" do
|
86
|
+
subject.venue.should be_a(Foursquared::Response::Venue)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should return the likes for the checkin" do
|
90
|
+
subject.likes["groups"].should each { |group|
|
91
|
+
group["items"].should be_empty_or_array_of_users
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should return the photos for the checkin" do
|
96
|
+
subject.photos.should each { |item|
|
97
|
+
item.should be_a Foursquared::Response::Photo
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/event_category'
|
3
|
+
|
4
|
+
describe Foursquared::Response::EventCategory do
|
5
|
+
|
6
|
+
let(:event_category) do
|
7
|
+
YAML.load(%{
|
8
|
+
id: "4dfb90c6bd413dd705e8f897"
|
9
|
+
name: "Movies"
|
10
|
+
pluralName: "Movies"
|
11
|
+
shortName: "Movie"
|
12
|
+
icon:
|
13
|
+
prefix: "https://foursquare.com/img/categories_v2/arts_entertainment/movietheater_"
|
14
|
+
suffix: ".png"
|
15
|
+
categories:
|
16
|
+
- id: "4e132f48bd41026cd50e8f8e"
|
17
|
+
name: "Baseball Games"
|
18
|
+
pluralName: "Baseball Games"
|
19
|
+
shortName: "Baseball"
|
20
|
+
icon:
|
21
|
+
prefix: "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_baseball_"
|
22
|
+
suffix: ".png"
|
23
|
+
categories: []
|
24
|
+
}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
subject {Foursquared::Response::EventCategory.new(event_category)}
|
29
|
+
|
30
|
+
describe "#icon" do
|
31
|
+
it "should have prefix, suffix and urls" do
|
32
|
+
subject.icon.keys.should ~ ["urls", "prefix", "suffix", ]
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "urls" do
|
36
|
+
it "should have urls for 32x32, 64x64 and 256x256 icons" do
|
37
|
+
subject.icon["urls"].keys.should ~ ["32x32", "64x64", "256x256"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should give the sub categories of the category" do
|
44
|
+
subject.categories.should each { |category|
|
45
|
+
category.should be_a(Foursquared::Response::EventCategory)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/event'
|
3
|
+
require 'pp'
|
4
|
+
describe Foursquared::Response::Event do
|
5
|
+
let(:event) do
|
6
|
+
YAML.load(%{
|
7
|
+
meta:
|
8
|
+
code: 200
|
9
|
+
response:
|
10
|
+
event:
|
11
|
+
venueId: "40afe980f964a5203bf31ee3"
|
12
|
+
id: "5093492991d4a3bd84c82646"
|
13
|
+
name: "Skyfall: The IMAX Experience"
|
14
|
+
foreignIds:
|
15
|
+
count: 1
|
16
|
+
items:
|
17
|
+
- domain: "fandango.com"
|
18
|
+
id: "5826-153164"
|
19
|
+
hereNow:
|
20
|
+
count: 0
|
21
|
+
groups:
|
22
|
+
- type: "friends"
|
23
|
+
name: "Friends here"
|
24
|
+
count: 0
|
25
|
+
items:
|
26
|
+
- id: "40430295"
|
27
|
+
firstName: "Benjamin"
|
28
|
+
lastName: "Peter"
|
29
|
+
relationship: "friend"
|
30
|
+
- type: "others"
|
31
|
+
name: "Other people here"
|
32
|
+
count: 0
|
33
|
+
items: []
|
34
|
+
allDay: true
|
35
|
+
date: 1355115600
|
36
|
+
timeZone: "America/New_York"
|
37
|
+
stats:
|
38
|
+
checkinsCount: 9
|
39
|
+
usersCount: 9
|
40
|
+
url: "https://foursquare.com/events/movies?theater=AAORE&movie=153164&wired=true"
|
41
|
+
}
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
subject { foursquared_test_client.event("5093492991d4a3bd84c82646") }
|
46
|
+
before :each do
|
47
|
+
stub_request(:get, "https://api.foursquare.com/v2/events/5093492991d4a3bd84c82646?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").to_return(:status => 200, :body => event.to_json, :headers => {})
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return groups of users who are present at the event now" do
|
51
|
+
subject.here_now["groups"].should each { |group|
|
52
|
+
group["items"].should be_empty_or_array_of_users
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should give the event date" do
|
57
|
+
subject.date.should be_a(Time)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/list'
|
3
|
+
describe Foursquared::Response::List do
|
4
|
+
let(:list) do
|
5
|
+
YAML.load(%{
|
6
|
+
meta:
|
7
|
+
code: 200
|
8
|
+
response:
|
9
|
+
list:
|
10
|
+
id: "5073f878e4b023c59da80d39"
|
11
|
+
name: "TOP MALLS IN KOCHI"
|
12
|
+
description: ""
|
13
|
+
type: "others"
|
14
|
+
user:
|
15
|
+
id: 12345
|
16
|
+
editable: false
|
17
|
+
public: true
|
18
|
+
collaborative: false
|
19
|
+
url: "https://foursquare.com/user/39000217/list/top-malls-in-kochi"
|
20
|
+
canonicalUrl: "https://foursquare.com/user/39000217/list/top-malls-in-kochi"
|
21
|
+
createdAt: 1349777528
|
22
|
+
updatedAt: 1349778775
|
23
|
+
photo:
|
24
|
+
id: "5073fb82f2e752674b569b36"
|
25
|
+
visitedCount: 1
|
26
|
+
venueCount: 1
|
27
|
+
following: false
|
28
|
+
})
|
29
|
+
end
|
30
|
+
|
31
|
+
subject { foursquared_test_client.list("5073f878e4b023c59da80d39") }
|
32
|
+
before :each do
|
33
|
+
stub_request(:get, "https://api.foursquare.com/v2/lists/5073f878e4b023c59da80d39?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
34
|
+
to_return(:status => 200, :body => list.to_json, :headers => {})
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return the list id" do
|
39
|
+
subject.id.should == "5073f878e4b023c59da80d39"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the user who created the list" do
|
43
|
+
subject.user.should be_a(Foursquared::Response::User)
|
44
|
+
subject.user.id == 12345
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return the photo associated with the list" do
|
48
|
+
subject.photo.should be_a(Foursquared::Response::Photo)
|
49
|
+
subject.photo.id.should == "5073fb82f2e752674b569b36"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return the timestamp the photo was created" do
|
53
|
+
subject.created_at.should be_a(Time)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/user'
|
3
|
+
require 'foursquared/response/photo'
|
4
|
+
require 'foursquared/client'
|
5
|
+
require 'pp'
|
6
|
+
describe Foursquared::Response::Photo do
|
7
|
+
|
8
|
+
let(:photo) do
|
9
|
+
YAML.load(%{
|
10
|
+
meta:
|
11
|
+
code: 200
|
12
|
+
response:
|
13
|
+
photo:
|
14
|
+
id: "12345"
|
15
|
+
createdAt: 1292875798
|
16
|
+
source:
|
17
|
+
name: "foursquare for iPhone"
|
18
|
+
url: "https://foursquare.com/download/#/iphone"
|
19
|
+
prefix: "https://irs0.4sqi.net/img/general/"
|
20
|
+
suffix: "/UYU54GYOCURPAUYXH5V2U3EOM4DCX4VZPT3YOMN43H555KU2.jpg"
|
21
|
+
width: 540
|
22
|
+
height: 720
|
23
|
+
user:
|
24
|
+
id: "2102"
|
25
|
+
firstName: "Kushal"
|
26
|
+
lastName: "D."
|
27
|
+
photo:
|
28
|
+
prefix: "https://irs1.4sqi.net/img/user/"
|
29
|
+
suffix: "/2102_1242573242.jpg"
|
30
|
+
visibility: "public"
|
31
|
+
}
|
32
|
+
)
|
33
|
+
end
|
34
|
+
subject {foursquared_test_client.photo(12345)}
|
35
|
+
|
36
|
+
before :each do
|
37
|
+
stub_request(:get, "https://api.foursquare.com/v2/photos/12345?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
38
|
+
to_return(:status => 200, :body => photo.to_json, :headers => {})
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return the photo id" do
|
42
|
+
subject.id.should == "12345"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return photo url's prefix" do
|
46
|
+
subject.prefix.should == "https://irs0.4sqi.net/img/general/"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return photo url's suffix" do
|
50
|
+
subject.suffix.should == "/UYU54GYOCURPAUYXH5V2U3EOM4DCX4VZPT3YOMN43H555KU2.jpg"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return the width of the photo" do
|
54
|
+
subject.width.should == 540
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return the height of the photo" do
|
58
|
+
subject.height.should == 720
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return the visibility of the photo" do
|
62
|
+
subject.visibility.should == "public"
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return the user associated with the photo" do
|
66
|
+
subject.user.should be_a(Foursquared::Response::User)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
end
|
File without changes
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/user'
|
3
|
+
require 'foursquared/response/list'
|
4
|
+
|
5
|
+
require 'foursquared/client'
|
6
|
+
require 'core_ext/symbol'
|
7
|
+
describe Foursquared::Response::User do
|
8
|
+
let(:me) do
|
9
|
+
YAML.load(%{
|
10
|
+
meta:
|
11
|
+
code: 200
|
12
|
+
response:
|
13
|
+
user:
|
14
|
+
id: "12345678"
|
15
|
+
firstName: "Rony"
|
16
|
+
lastName: "Varghese"
|
17
|
+
relationship: "self"
|
18
|
+
photo:
|
19
|
+
prefix: "https://irs1.4sqi.net/img/user/"
|
20
|
+
suffix: "/HE1OX3T3S3HN5OI4.jpg"
|
21
|
+
friends:
|
22
|
+
count: 61
|
23
|
+
groups:
|
24
|
+
- type: "friends"
|
25
|
+
name: "Mutual friends"
|
26
|
+
count: 0
|
27
|
+
items: []
|
28
|
+
- type: "others"
|
29
|
+
name: "Other friends"
|
30
|
+
count: 61
|
31
|
+
items:
|
32
|
+
- id: "40430295"
|
33
|
+
firstName: "Benjamin"
|
34
|
+
lastName: "Peter"
|
35
|
+
relationship: "friend"
|
36
|
+
photo:
|
37
|
+
prefix: "https://irs0.4sqi.net/img/user/"
|
38
|
+
suffix: "/4GBCUQTWEX4H4KNZ.jpg"
|
39
|
+
tips:
|
40
|
+
count: 0
|
41
|
+
lists:
|
42
|
+
groups:
|
43
|
+
- type: "created"
|
44
|
+
count: 1
|
45
|
+
items: []
|
46
|
+
gender: "male"
|
47
|
+
homeCity: "Maharashtra"
|
48
|
+
bio: ""
|
49
|
+
contact:
|
50
|
+
email: "blahblah@blah.com"
|
51
|
+
facebook: "435463435"
|
52
|
+
lists:
|
53
|
+
count: 5
|
54
|
+
groups:
|
55
|
+
- type: "created"
|
56
|
+
count: 3
|
57
|
+
items:
|
58
|
+
- id: "25052241/todos"
|
59
|
+
name: "My to-do list"
|
60
|
+
description: ""
|
61
|
+
user:
|
62
|
+
id: "25052241"
|
63
|
+
firstName: "Rony"
|
64
|
+
lastName: "Varghese"
|
65
|
+
relationship: "self"
|
66
|
+
photo:
|
67
|
+
prefix: "https://irs1.4sqi.net/img/user/"
|
68
|
+
suffix: "/HE1OX3T3S3HN5OI4.jpg"
|
69
|
+
editable: false
|
70
|
+
public: false
|
71
|
+
collaborative: false
|
72
|
+
url: "https://foursquare.com/user/25052241/list/todos"
|
73
|
+
canonicalUrl: "https://foursquare.com/user/25052241/list/todos"
|
74
|
+
followers:
|
75
|
+
count: 0
|
76
|
+
listItems:
|
77
|
+
count: 0
|
78
|
+
}
|
79
|
+
)
|
80
|
+
end
|
81
|
+
subject { foursquared_test_client.user("self") }
|
82
|
+
before :each do
|
83
|
+
stub_request(:get, "https://api.foursquare.com/v2/users/self?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
84
|
+
to_return(:status => 200, :body => me.to_json, :headers => {})
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should get user's id" do
|
88
|
+
subject.id.should == "12345678"
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should return user's firstname" do
|
92
|
+
subject.first_name.should == "Rony"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "shoyld return user's last name" do
|
96
|
+
subject.last_name.should == "Varghese"
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should give the relationship between 'me' and the current user" do
|
100
|
+
subject.relationship.should == "self"
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#friends" do
|
104
|
+
it "should return the user's friends" do
|
105
|
+
subject.friends["groups"].should each { |group|
|
106
|
+
group["items"].should be_empty_or_array_of_users
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should have different type of friends" do
|
111
|
+
subject.friends["groups"].collect{ |group| group["type"] }.should be_unique
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#lists" do
|
116
|
+
it "should return the user's lists" do
|
117
|
+
subject.lists["groups"].should each { |group|
|
118
|
+
group["items"].should be_empty_or_array_of_lists
|
119
|
+
}
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foursquared/response/user'
|
3
|
+
require 'foursquared/response/list'
|
4
|
+
|
5
|
+
require 'foursquared/client'
|
6
|
+
require 'core_ext/symbol'
|
7
|
+
|
8
|
+
describe Foursquared::Response::Venue do
|
9
|
+
let(:venue) do
|
10
|
+
YAML.load(%{
|
11
|
+
meta:
|
12
|
+
code: 200
|
13
|
+
response:
|
14
|
+
venue:
|
15
|
+
id: "40a55d80f964a52020f31ee3"
|
16
|
+
name: "Clinton Street Baking Co."
|
17
|
+
contact:
|
18
|
+
phone: "+16466026263"
|
19
|
+
formattedPhone: "+1 646-602-6263"
|
20
|
+
location:
|
21
|
+
address: "4 Clinton St."
|
22
|
+
crossStreet: "at E Houston St."
|
23
|
+
lat: 40.721294
|
24
|
+
lng: -73.983994
|
25
|
+
postalCode: "10002"
|
26
|
+
city: "New York"
|
27
|
+
state: "NY"
|
28
|
+
country: "United States"
|
29
|
+
cc: "US"
|
30
|
+
verified: false
|
31
|
+
stats:
|
32
|
+
checkinsCount: 9233
|
33
|
+
usersCount: 6835
|
34
|
+
tipCount: 244
|
35
|
+
url: "http://www.clintonstreetbaking.com"
|
36
|
+
like: false
|
37
|
+
dislike: false
|
38
|
+
rating: 9.69
|
39
|
+
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:likes) do
|
45
|
+
YAML.load(%{
|
46
|
+
meta:
|
47
|
+
code: 200
|
48
|
+
response:
|
49
|
+
likes:
|
50
|
+
count: 42
|
51
|
+
groups:
|
52
|
+
- type: "others"
|
53
|
+
count: 42
|
54
|
+
items:
|
55
|
+
- id: "141623"
|
56
|
+
firstName: "chad"
|
57
|
+
lastName: "g."
|
58
|
+
photo:
|
59
|
+
prefix: "https://irs2.4sqi.net/img/user/"
|
60
|
+
suffix: "/X521V5IIEPN2Y3F5.jpg"
|
61
|
+
- id: "16066"
|
62
|
+
firstName: "Allan"
|
63
|
+
lastName: "B."
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
subject { foursquared_test_client.venue("40a55d80f964a52020f31ee3")}
|
69
|
+
|
70
|
+
before :each do
|
71
|
+
stub_request(:get, "https://api.foursquare.com/v2/venues/40a55d80f964a52020f31ee3?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
72
|
+
to_return(:status => 200, :body => venue.to_json, :headers => {})
|
73
|
+
stub_request(:get, "https://api.foursquare.com/v2/venues/40a55d80f964a52020f31ee3/likes?oauth_token=TestToken&v=#{Time.now.strftime("%Y%m%d")}").
|
74
|
+
to_return(:status => 200, :body => likes.to_json, :headers => {})
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should return the likes for the venue" do
|
78
|
+
subject.likes["groups"].should each { |group|
|
79
|
+
group["items"].should be_empty_or_array_of_users
|
80
|
+
}
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|