untappd 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.rdoc +32 -26
- data/examples/aba_checkins.rb +1 -1
- data/examples/checkin.rb +28 -0
- data/lib/untappd.rb +11 -2
- data/lib/untappd/base.rb +6 -0
- data/lib/untappd/checkin.rb +78 -0
- data/lib/untappd/user.rb +13 -0
- data/lib/untappd/version.rb +1 -1
- data/spec/beer_spec.rb +13 -5
- data/spec/brewery_spec.rb +3 -1
- data/spec/checkin_spec.rb +68 -18
- data/spec/user_spec.rb +34 -9
- data/spec/venue_spec.rb +5 -1
- data/untappd.gemspec +1 -1
- metadata +6 -5
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -10,6 +10,7 @@ the API documentation.
|
|
10
10
|
|
11
11
|
== Releases
|
12
12
|
|
13
|
+
* 0.0.4 Complete coverage of v3 API. Checkins, Comments, Toasts, gmt_offset configuration
|
13
14
|
* 0.0.3 Venue Info & Feed, Trending Beer, Brewery Feed, Checkin info & Feed (the pub), Renamed Beer.checkins to Beer.feed
|
14
15
|
* 0.0.2 User feed, distinct beers, info, badges, friends, wish list
|
15
16
|
* 0.0.1 Beer Search, Info and Checkins
|
@@ -17,54 +18,59 @@ the API documentation.
|
|
17
18
|
== API Coverage
|
18
19
|
|
19
20
|
Beer Object
|
20
|
-
* Beer Feed - Untappd::Beer.feed
|
21
|
-
* Beer Info - Untappd::Beer.info
|
22
|
-
* Beer Search - Untappd::Beer.search
|
23
|
-
* Trending - Untappd::Beer.trending
|
21
|
+
* Beer Feed - Untappd::Beer.feed(beer_id, options={})
|
22
|
+
* Beer Info - Untappd::Beer.info(beer_id, options={})
|
23
|
+
* Beer Search - Untappd::Beer.search(q, options={})
|
24
|
+
* Trending - Untappd::Beer.trending(options={})
|
24
25
|
|
25
26
|
User Object
|
26
|
-
* User Feed - Untappd::User.feed
|
27
|
-
* User Info - Untappd::User.info
|
28
|
-
* User Badges - Untappd::User.badges
|
29
|
-
* User Friends - Untappd::User.friends
|
30
|
-
* User Wish List - Untappd::User.wish_list
|
31
|
-
* User Distinct Beers - Untappd::User.distinct
|
27
|
+
* User Feed - Untappd::User.feed(user, options={})
|
28
|
+
* User Info - Untappd::User.info(user, options={})
|
29
|
+
* User Badges - Untappd::User.badges(user, options={})
|
30
|
+
* User Friends - Untappd::User.friends(user, options={})
|
31
|
+
* User Wish List - Untappd::User.wish_list(user, options={})
|
32
|
+
* User Distinct Beers - Untappd::User.distinct(user, options={})
|
33
|
+
* Friend Feed - Untappd::User.friend_feed(username, password, options={})
|
32
34
|
|
33
35
|
Venue Object
|
34
|
-
* Venue Feed - Untappd::Venue.feed
|
35
|
-
* Venue Info - Untappd::Venue.info
|
36
|
+
* Venue Feed - Untappd::Venue.feed(venue_id, options={})
|
37
|
+
* Venue Info - Untappd::Venue.info(venue_id, options={})
|
36
38
|
|
37
39
|
Brewery Object
|
38
|
-
* Brewery Checkins - Untappd::Brewery.feed
|
40
|
+
* Brewery Checkins - Untappd::Brewery.feed(brewery_id, options={})
|
39
41
|
|
40
42
|
Checkin Object
|
41
|
-
* The Pub Feed - Untappd::Checkin.feed
|
42
|
-
* Checkin Info - Untappd::Checkin.info
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
*
|
47
|
-
* Checkin
|
48
|
-
* Checkin
|
49
|
-
* Add Comment
|
50
|
-
* Remove Comment
|
51
|
-
* Toast
|
52
|
-
* Remove Toast
|
43
|
+
* The Pub Feed - Untappd::Checkin.feed(options={})
|
44
|
+
* Checkin Info - Untappd::Checkin.info(checkin_id, options={})
|
45
|
+
* Checkin (Test) - Untappd::Checkin.test(username, password, beer_id, options={})
|
46
|
+
* Checkin - Untappd::Checkin.create(username, password, beer_id, options={})
|
47
|
+
* Add Comment - Untappd::Checkin.add_comment(username, password, checkin_id, comment, options={})
|
48
|
+
* Remove Comment - Untappd::Checkin.remove_comment(username, password, comment_id, options={})
|
49
|
+
* Toast - Untappd::Checkin.toast(username, password, checkin_id)
|
50
|
+
* Remove Toast - Untappd::Checkin.untoast(username, password, checkin_id)
|
53
51
|
|
54
52
|
== Examples
|
55
53
|
Configure your API KEY
|
56
54
|
|
57
55
|
Untappd.configure do |config|
|
58
56
|
config.apikey = 'YOUR_API_KEY'
|
57
|
+
config.gmt_offset = -5
|
59
58
|
end
|
60
59
|
|
61
60
|
Get all the checkins for Arrogant Bastard Ale
|
62
61
|
|
63
|
-
checkins = Untappd::Beer.
|
62
|
+
checkins = Untappd::Beer.feed(18099) # or Untappd::User.feed("cmar")
|
64
63
|
checkins.each do |checkin|
|
65
64
|
puts "#{checkin.user.first_name} at #{checkin.created_at}"
|
66
65
|
end
|
67
66
|
|
67
|
+
Create Checkin
|
68
|
+
#foursqure, lat, lng are optional
|
69
|
+
Untappd::Checkin.create("cmar", "PASSWORD", 4665,
|
70
|
+
:foursquare_id => "4ad6bf91f964a520380821e3",
|
71
|
+
:user_lat => "51.4718",
|
72
|
+
:user_lng => "-0.489278")
|
73
|
+
|
68
74
|
Search for beers with the name Stone
|
69
75
|
|
70
76
|
beers = Untappd::Beer.search('stone')
|
data/examples/aba_checkins.rb
CHANGED
data/examples/checkin.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#a couple of checkin methods
|
2
|
+
require 'rubygems'
|
3
|
+
require 'untappd'
|
4
|
+
|
5
|
+
Untappd.configure do |config|
|
6
|
+
config.apikey = 'YOUR_API_KEY'
|
7
|
+
config.gmt_offset = -5
|
8
|
+
end
|
9
|
+
|
10
|
+
username = "cmar"
|
11
|
+
password = "password"
|
12
|
+
|
13
|
+
checkin = Untappd::Checkin.create(username, password, 4665,
|
14
|
+
:foursquare_id => "4ad6bf91f964a520380821e3",
|
15
|
+
:user_lat => "51.4718",
|
16
|
+
:user_lng => "-0.489278")
|
17
|
+
|
18
|
+
puts checkin.inspect
|
19
|
+
|
20
|
+
|
21
|
+
feed = Untappd::User.friend_feed(username, password)
|
22
|
+
puts feed.inspect
|
23
|
+
|
24
|
+
comment = Untappd::Checkin.add_comment(username, password, 414882, "this is a test")
|
25
|
+
puts comment.inspect
|
26
|
+
|
27
|
+
result = Untappd::Checkin.toast(username, password, 414882)
|
28
|
+
puts result.inspect
|
data/lib/untappd.rb
CHANGED
@@ -8,8 +8,9 @@ require "untappd/brewery"
|
|
8
8
|
require "untappd/checkin"
|
9
9
|
|
10
10
|
module Untappd
|
11
|
-
|
12
|
-
|
11
|
+
@@apikey = nil
|
12
|
+
@@gmt_offset = 0
|
13
|
+
|
13
14
|
def self.apikey
|
14
15
|
@@apikey
|
15
16
|
end
|
@@ -18,6 +19,14 @@ module Untappd
|
|
18
19
|
@@apikey = apikey
|
19
20
|
end
|
20
21
|
|
22
|
+
def self.gmt_offset
|
23
|
+
@@gmt_offset
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.gmt_offset=(gmt_offset)
|
27
|
+
@@gmt_offset = gmt_offset
|
28
|
+
end
|
29
|
+
|
21
30
|
def self.configure
|
22
31
|
yield self
|
23
32
|
end
|
data/lib/untappd/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'hashie'
|
3
|
+
require 'digest/md5'
|
3
4
|
|
4
5
|
module Untappd
|
5
6
|
|
@@ -15,6 +16,11 @@ module Untappd
|
|
15
16
|
Hashie::Mash.new {}
|
16
17
|
end
|
17
18
|
end
|
19
|
+
|
20
|
+
def self.auth_hash(username, password)
|
21
|
+
{:username => username,
|
22
|
+
:password => Digest::MD5.hexdigest(password)}
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
end
|
data/lib/untappd/checkin.rb
CHANGED
@@ -23,7 +23,85 @@ module Untappd
|
|
23
23
|
|
24
24
|
response_to_mash get("/thepub", :query => options)
|
25
25
|
end
|
26
|
+
|
27
|
+
# foursquare_id (optional) - The MD5 hash ID of the Venue you want to attach
|
28
|
+
# the beer checkin. This HAS TO BE the MD5 non-numeric hash from the foursquare v2. Older numeric id will not be accepted.
|
29
|
+
# user_lat (optional) - The numeric Latitude of the user. This is required if you add a location.
|
30
|
+
# user_lng (optional) - The numeric Longitude of the user. This is required if you add a location.
|
31
|
+
# shout (optional) - The text you would like to include as a comment of the checkin. Max of 140 characters.
|
32
|
+
# facebook (optional) - Default = "off", Pass "on" to post to facebook
|
33
|
+
# twitter (optional) - Default = "off", Pass "on" to post to twitter
|
34
|
+
# foursquare (optional) - Default = "off", Pass "on" to checkin on foursquare
|
35
|
+
def self.create(username, password, beer_id, options={})
|
36
|
+
|
37
|
+
options.merge!({
|
38
|
+
:gmt_offset => Untappd::gmt_offset,
|
39
|
+
:bid => beer_id
|
40
|
+
})
|
41
|
+
|
42
|
+
response = post("/checkin", :query => { :key => Untappd::apikey },
|
43
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
44
|
+
|
45
|
+
Hashie::Mash.new(response)
|
46
|
+
end
|
47
|
+
|
48
|
+
# foursquare_id (optional) - The MD5 hash ID of the Venue you want to attach the beer checkin.
|
49
|
+
# This HAS TO BE the MD5 non-numeric hash from the foursquare v2. Older numeric id will not be accepted.
|
50
|
+
# user_lat (optional) - The numeric Latitude of the user. This is required if you add a location.
|
51
|
+
# user_lng (optional) - The numeric Longitude of the user. This is required if you add a location.
|
52
|
+
def self.test(username, password, beer_id, options={})
|
53
|
+
options.merge!({
|
54
|
+
:gmt_offset => Untappd::gmt_offset,
|
55
|
+
:bid => beer_id
|
56
|
+
})
|
57
|
+
|
58
|
+
response = post("/checkin_test", :query => { :key => Untappd::apikey },
|
59
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
60
|
+
|
61
|
+
Hashie::Mash.new(response)
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
def self.add_comment(username, password, checkin_id, comment, options={})
|
66
|
+
options.merge!({
|
67
|
+
:checkin_id => checkin_id,
|
68
|
+
:comment => comment
|
69
|
+
})
|
70
|
+
|
71
|
+
response_to_mash post("/add_comment", :query => { :key => Untappd::apikey },
|
72
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
73
|
+
end
|
26
74
|
|
75
|
+
#
|
76
|
+
def self.remove_comment(username, password, comment_id, options={})
|
77
|
+
options.merge!({
|
78
|
+
:comment_id => comment_id
|
79
|
+
})
|
80
|
+
|
81
|
+
response_to_mash post("/delete_comment", :query => { :key => Untappd::apikey },
|
82
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
83
|
+
end
|
84
|
+
|
85
|
+
#
|
86
|
+
def self.toast(username, password, checkin_id, options={})
|
87
|
+
options.merge!({
|
88
|
+
:checkin_id => checkin_id
|
89
|
+
})
|
90
|
+
|
91
|
+
response_to_mash post("/toast", :query => { :key => Untappd::apikey },
|
92
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
93
|
+
end
|
94
|
+
|
95
|
+
#
|
96
|
+
def self.untoast(username, password, checkin_id, options={})
|
97
|
+
options.merge!({
|
98
|
+
:checkin_id => checkin_id
|
99
|
+
})
|
100
|
+
|
101
|
+
response_to_mash post("/delete_toast", :query => { :key => Untappd::apikey },
|
102
|
+
:body => options, :basic_auth => auth_hash(username, password))
|
103
|
+
end
|
104
|
+
|
27
105
|
end
|
28
106
|
|
29
107
|
end
|
data/lib/untappd/user.rb
CHANGED
@@ -58,6 +58,19 @@ module Untappd
|
|
58
58
|
|
59
59
|
response_to_mash get("/user_feed", :query => options)
|
60
60
|
end
|
61
|
+
|
62
|
+
# since (optional) - The numeric ID of the last recent check-in.
|
63
|
+
# offset (optional) - The offset that you like the dataset to begin with.
|
64
|
+
# Each set returns 25 max records, so you can use that paginate the feed.
|
65
|
+
def self.friend_feed(username, password, options={})
|
66
|
+
options.merge!({
|
67
|
+
:key => Untappd::apikey
|
68
|
+
})
|
69
|
+
|
70
|
+
response_to_mash get("/feed", :basic_auth => auth_hash(username, password),
|
71
|
+
:query => options)
|
72
|
+
end
|
73
|
+
|
61
74
|
end
|
62
75
|
|
63
76
|
end
|
data/lib/untappd/version.rb
CHANGED
data/spec/beer_spec.rb
CHANGED
@@ -14,40 +14,48 @@ describe "Beer" do
|
|
14
14
|
Untappd::Beer.stub(:get => @response)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "get feed" do
|
18
18
|
@response[:results] << {:checkin_id => "610208",
|
19
19
|
:beer_id => "18099",
|
20
20
|
:beer_name => "Arrogant Bastard Ale",
|
21
21
|
:brewery_name => "Stone Brewing Co."}
|
22
22
|
|
23
|
+
Untappd::Beer.should_receive(:get).with("/beer_checkins", anything())
|
24
|
+
|
23
25
|
checkins = Untappd::Beer.feed(18099)
|
24
26
|
checkins.first.beer_name.should == "Arrogant Bastard Ale"
|
25
27
|
end
|
26
28
|
|
27
|
-
it "
|
29
|
+
it "get info" do
|
28
30
|
@response[:results] = {:brewery_id => "1204",
|
29
31
|
:beer_id => "18099",
|
30
32
|
:name => "Arrogant Bastard Ale",
|
31
33
|
:brewery => "Stone Brewing Co."}
|
32
34
|
|
35
|
+
Untappd::Beer.should_receive(:get).with("/beer_info", anything())
|
36
|
+
|
33
37
|
info = Untappd::Beer.info(18099)
|
34
38
|
info.name.should == "Arrogant Bastard Ale"
|
35
39
|
end
|
36
40
|
|
37
|
-
it "
|
41
|
+
it "get search" do
|
38
42
|
@response[:results] << {:beer_id => "18099",
|
39
43
|
:beer_name => "Arrogant Bastard Ale",
|
40
44
|
:brewery_name => "Stone Brewing Co."}
|
41
45
|
|
42
|
-
|
46
|
+
Untappd::Beer.should_receive(:get).with("/beer_search", anything())
|
47
|
+
|
48
|
+
search = Untappd::Beer.search('stone')
|
43
49
|
search.first.beer_name.should == "Arrogant Bastard Ale"
|
44
50
|
end
|
45
51
|
|
46
|
-
it "
|
52
|
+
it "get trending beers" do
|
47
53
|
@response[:results] << {:beer_id => "18099",
|
48
54
|
:beer_name => "Arrogant Bastard Ale",
|
49
55
|
:brewery_name => "Stone Brewing Co."}
|
50
56
|
|
57
|
+
Untappd::Beer.should_receive(:get).with("/trending", anything())
|
58
|
+
|
51
59
|
trending = Untappd::Beer.trending()
|
52
60
|
trending.first.beer_name.should == "Arrogant Bastard Ale"
|
53
61
|
end
|
data/spec/brewery_spec.rb
CHANGED
@@ -14,13 +14,15 @@ describe "Brewery" do
|
|
14
14
|
Untappd::Brewery.stub(:get => @response)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "get feed" do
|
18
18
|
@response[:results] << { :user => {:user_name => "cmar"},
|
19
19
|
:checkin_id => "610233",
|
20
20
|
:beer_id => "18099",
|
21
21
|
:beer_name => "Arrogant Bastard Ale",
|
22
22
|
:brewery_name => "Stone Brewing Co."}
|
23
23
|
|
24
|
+
Untappd::Brewery.should_receive(:get).with("/brewery_checkins", anything())
|
25
|
+
|
24
26
|
feed = Untappd::Brewery.feed(18099)
|
25
27
|
feed.first.beer_name.should == "Arrogant Bastard Ale"
|
26
28
|
end
|
data/spec/checkin_spec.rb
CHANGED
@@ -7,33 +7,83 @@ describe "Checkin" do
|
|
7
7
|
config.apikey = '6666666666666666666666'
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
before(:each) do
|
12
12
|
@response = {:results =>[]}
|
13
13
|
@response.stub(:code => 200)
|
14
|
-
Untappd::Checkin.stub(:get => @response)
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
context "post" do
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
Untappd::Checkin.stub(:post => @response)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "add comment" do
|
23
|
+
Untappd::Checkin.should_receive(:post).with("/add_comment", anything())
|
24
|
+
Untappd::Checkin.add_comment("cmar", "password", 666, "my fancy comment")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "removes comment" do
|
28
|
+
Untappd::Checkin.should_receive(:post).with("/delete_comment", anything())
|
29
|
+
Untappd::Checkin.remove_comment("cmar", "password", 666)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "adds toast" do
|
33
|
+
Untappd::Checkin.should_receive(:post).with("/toast", anything())
|
34
|
+
Untappd::Checkin.toast("cmar", "password", 666)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "removes toast" do
|
38
|
+
Untappd::Checkin.should_receive(:post).with("/delete_toast", anything())
|
39
|
+
Untappd::Checkin.untoast("cmar", "password", 666)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "creates checkin" do
|
43
|
+
Untappd::Checkin.should_receive(:post).with("/checkin", anything())
|
44
|
+
Untappd::Checkin.create("cmar", "password", 4665)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "creates test checkin" do
|
48
|
+
Untappd::Checkin.should_receive(:post).with("/checkin_test", anything())
|
49
|
+
Untappd::Checkin.test("cmar", "password", 4665)
|
50
|
+
end
|
51
|
+
|
26
52
|
end
|
27
53
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
54
|
+
context "get" do
|
55
|
+
|
56
|
+
before(:each) do
|
57
|
+
Untappd::Checkin.stub(:get => @response)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "gets info" do
|
61
|
+
@response[:results] = { :user => {:user_name => "cmar"},
|
62
|
+
:checkin_id => "610233",
|
63
|
+
:beer_id => "18099",
|
64
|
+
:beer_name => "Arrogant Bastard Ale",
|
65
|
+
:brewery_name => "Stone Brewing Co."}
|
33
66
|
|
34
|
-
|
35
|
-
|
67
|
+
Untappd::Checkin.should_receive(:get).with("/details", anything())
|
68
|
+
|
69
|
+
checkin = Untappd::Checkin.info(18099)
|
70
|
+
checkin.beer_name.should == "Arrogant Bastard Ale"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "gets thepub feed" do
|
74
|
+
@response[:results] << {:checkin_id => "610208",
|
75
|
+
:beer_id => "18099",
|
76
|
+
:beer_name => "Arrogant Bastard Ale",
|
77
|
+
:brewery_name => "Stone Brewing Co."}
|
78
|
+
|
79
|
+
Untappd::Checkin.should_receive(:get).with("/thepub", anything())
|
80
|
+
|
81
|
+
checkins = Untappd::Checkin.feed()
|
82
|
+
checkins.first.beer_name.should == "Arrogant Bastard Ale"
|
83
|
+
end
|
84
|
+
|
36
85
|
end
|
86
|
+
|
37
87
|
end
|
38
88
|
|
39
89
|
|
data/spec/user_spec.rb
CHANGED
@@ -14,70 +14,95 @@ describe "User" do
|
|
14
14
|
Untappd::User.stub(:get => @response)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "get info" do
|
18
18
|
@response[:results] = {:user => {
|
19
19
|
:user_name => "cmar",
|
20
20
|
:first_name => "cmar"
|
21
21
|
}
|
22
22
|
}
|
23
|
-
|
23
|
+
|
24
|
+
Untappd::User.should_receive(:get).with("/user", anything())
|
25
|
+
|
24
26
|
info = Untappd::User.info("cmar")
|
25
27
|
info.user.user_name.should == "cmar"
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
30
|
+
it "get badges" do
|
29
31
|
@response[:results] << {
|
30
32
|
:badge_name => "Newbie",
|
31
33
|
:checkin_id => "413105"
|
32
34
|
}
|
33
|
-
|
35
|
+
|
36
|
+
Untappd::User.should_receive(:get).with("/user_badge", anything())
|
37
|
+
|
34
38
|
badges = Untappd::User.badges("cmar")
|
35
39
|
badges.first.badge_name.should == "Newbie"
|
36
40
|
end
|
37
41
|
|
38
|
-
it "
|
42
|
+
it "get friends" do
|
39
43
|
@response[:results] << {
|
40
44
|
:user_name => "pks1850",
|
41
45
|
:user_id => "10819"
|
42
46
|
}
|
43
47
|
|
48
|
+
Untappd::User.should_receive(:get).with("/friends", anything())
|
49
|
+
|
44
50
|
friends = Untappd::User.friends("cmar")
|
45
51
|
friends.first.user_name.should == "pks1850"
|
46
52
|
end
|
47
53
|
|
48
|
-
it "
|
54
|
+
it "get wish list" do
|
49
55
|
@response[:results] << {
|
50
56
|
:user => {:user_name => "cmar"},
|
51
57
|
:beer_name => "Aprihop",
|
52
58
|
:beer_id => "4665"
|
53
59
|
}
|
54
60
|
|
61
|
+
Untappd::User.should_receive(:get).with("/wish_list", anything())
|
62
|
+
|
55
63
|
wish_list = Untappd::User.wish_list("cmar")
|
56
64
|
wish_list.first.beer_name.should == "Aprihop"
|
57
65
|
end
|
58
66
|
|
59
|
-
it "
|
67
|
+
it "get distinct beers" do
|
60
68
|
@response[:results] << {
|
61
69
|
:user => {:user_name => "cmar"},
|
62
70
|
:beer_name => "Aprihop",
|
63
71
|
:beer_id => "4665"
|
64
72
|
}
|
65
|
-
|
73
|
+
|
74
|
+
Untappd::User.should_receive(:get).with("/distinct", anything())
|
75
|
+
|
66
76
|
distinct_beers = Untappd::User.distinct("cmar")
|
67
77
|
distinct_beers.first.beer_name.should == "Aprihop"
|
68
78
|
end
|
69
79
|
|
70
|
-
it "
|
80
|
+
it "get feed" do
|
71
81
|
@response[:results] << {
|
72
82
|
:user => {:user_name => "cmar"},
|
73
83
|
:beer_name => "Aprihop",
|
74
84
|
:checkin_id => "551239"
|
75
85
|
}
|
76
86
|
|
87
|
+
Untappd::User.should_receive(:get).with("/user_feed", anything())
|
88
|
+
|
77
89
|
feed = Untappd::User.feed("cmar")
|
78
90
|
feed.first.beer_name.should == "Aprihop"
|
79
91
|
end
|
80
92
|
|
93
|
+
it "get friend feed" do
|
94
|
+
@response[:results] << {
|
95
|
+
:user => {:user_name => "cmar"},
|
96
|
+
:beer_name => "Aprihop",
|
97
|
+
:checkin_id => "551239"
|
98
|
+
}
|
99
|
+
|
100
|
+
Untappd::User.should_receive(:get).with("/feed", anything())
|
101
|
+
|
102
|
+
feed = Untappd::User.friend_feed("cmar", "password")
|
103
|
+
feed.first.checkin_id.should == "551239"
|
104
|
+
end
|
105
|
+
|
81
106
|
end
|
82
107
|
|
83
108
|
#User feed JSON
|
data/spec/venue_spec.rb
CHANGED
@@ -20,7 +20,9 @@ describe "Venue" do
|
|
20
20
|
:beer_id => "18099",
|
21
21
|
:beer_name => "Arrogant Bastard Ale",
|
22
22
|
:brewery_name => "Stone Brewing Co."}
|
23
|
-
|
23
|
+
|
24
|
+
Untappd::Venue.should_receive(:get).with("/venue_checkins", anything())
|
25
|
+
|
24
26
|
feed = Untappd::Venue.feed(18099)
|
25
27
|
feed.first.beer_name.should == "Arrogant Bastard Ale"
|
26
28
|
end
|
@@ -30,6 +32,8 @@ describe "Venue" do
|
|
30
32
|
:foursquare_id => "4ad6bf91f964a520380821e3"
|
31
33
|
}
|
32
34
|
|
35
|
+
Untappd::Venue.should_receive(:get).with("/venue_info", anything())
|
36
|
+
|
33
37
|
info = Untappd::Venue.info(18099)
|
34
38
|
info.name.should == "Terminal 5"
|
35
39
|
end
|
data/untappd.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Untappd::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["cmar"]
|
10
|
-
s.email = ["
|
10
|
+
s.email = ["christopher.mar@gmail.com"]
|
11
11
|
s.homepage = "http://cmar.me"
|
12
12
|
s.summary = %q{Wrapper around the untappd.com API}
|
13
13
|
s.description = %q{wrapper around the untappd.com API}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: untappd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- cmar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-14 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version_requirements: *id003
|
69
69
|
description: wrapper around the untappd.com API
|
70
70
|
email:
|
71
|
-
-
|
71
|
+
- christopher.mar@gmail.com
|
72
72
|
executables: []
|
73
73
|
|
74
74
|
extensions: []
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- README.rdoc
|
83
83
|
- Rakefile
|
84
84
|
- examples/aba_checkins.rb
|
85
|
+
- examples/checkin.rb
|
85
86
|
- examples/user_feed.rb
|
86
87
|
- lib/untappd.rb
|
87
88
|
- lib/untappd/base.rb
|