untappd 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,9 +7,13 @@ the API documentation.
7
7
  * You will need to register for an API key: http://untappd.com/api/register
8
8
  * Attempting to wrap all the API documented here: http://untappd.com/api/docs/v3
9
9
  * All options can be passed into the calls
10
+ * Untappd v3 doesn't support oauth so you must pass your username and password
11
+ * passwords are md5 hashed before they sent over the wire
12
+ * all returns are wrapped in a Hashie::Mash
10
13
 
11
14
  == Releases
12
15
 
16
+ * 0.0.5 Brewery Info and Search
13
17
  * 0.0.4 Complete coverage of v3 API. Checkins, Comments, Toasts, gmt_offset configuration
14
18
  * 0.0.3 Venue Info & Feed, Trending Beer, Brewery Feed, Checkin info & Feed (the pub), Renamed Beer.checkins to Beer.feed
15
19
  * 0.0.2 User feed, distinct beers, info, badges, friends, wish list
@@ -38,18 +42,25 @@ Venue Object
38
42
 
39
43
  Brewery Object
40
44
  * Brewery Checkins - Untappd::Brewery.feed(brewery_id, options={})
45
+ * Brewery Info - Untappd::Brewery.info(brewery_id, options={})
46
+ * Brewery Search - Untappd::Brewery.search(q, options={})
41
47
 
42
48
  Checkin Object
43
49
  * The Pub Feed - Untappd::Checkin.feed(options={})
44
50
  * Checkin Info - Untappd::Checkin.info(checkin_id, options={})
45
51
  * Checkin (Test) - Untappd::Checkin.test(username, password, beer_id, options={})
46
52
  * 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={})
53
+ * Add Comment - Untappd::Checkin.add_comment(username, password, checkin_id, comment)
54
+ * Remove Comment - Untappd::Checkin.remove_comment(username, password, comment_id)
49
55
  * Toast - Untappd::Checkin.toast(username, password, checkin_id)
50
56
  * Remove Toast - Untappd::Checkin.untoast(username, password, checkin_id)
51
57
 
58
+
52
59
  == Examples
60
+ Add to your GemFile
61
+
62
+ gem 'untappd'
63
+
53
64
  Configure your API KEY
54
65
 
55
66
  Untappd.configure do |config|
@@ -14,6 +14,26 @@ module Untappd
14
14
  response_to_mash get("/brewery_checkins", :query => options)
15
15
  end
16
16
 
17
+ # This method will allow you to see extended information about a brewery.
18
+ def self.info(brewery_id, options={})
19
+ options.merge!({
20
+ :key => Untappd::apikey,
21
+ :brewery_id => brewery_id
22
+ })
23
+
24
+ response_to_mash get("/brewery_info", :query => options)
25
+ end
26
+
27
+ #
28
+ def self.search(q, options={})
29
+ options.merge!({
30
+ :key => Untappd::apikey,
31
+ :q => q
32
+ })
33
+
34
+ response_to_mash get("/brewery_search", :query => options)
35
+ end
36
+
17
37
  end
18
38
 
19
39
  end
@@ -1,3 +1,3 @@
1
1
  module Untappd
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -27,8 +27,33 @@ describe "Brewery" do
27
27
  feed.first.beer_name.should == "Arrogant Bastard Ale"
28
28
  end
29
29
 
30
+ it "get info" do
31
+ @response[:results] = { :name => "Pizza Beer",
32
+ :brewery_id => "1000"}
33
+
34
+ Untappd::Brewery.should_receive(:get).with("/brewery_info", anything())
35
+
36
+ info = Untappd::Brewery.info(1000)
37
+ info.name.should == "Pizza Beer"
38
+ end
39
+
40
+ it "get search" do
41
+ @response[:results] << { :brewery_id => "18099",
42
+ :brewery_name => "Stone Brewing Co."}
43
+
44
+ Untappd::Brewery.should_receive(:get).with("/brewery_search", anything())
45
+
46
+ feed = Untappd::Brewery.search(18099)
47
+ feed.first.brewery_name.should == "Stone Brewing Co."
48
+ end
49
+
30
50
  end
31
51
 
52
+ # Brewery Search
53
+ #{"http_code":200,"returned_results":25,"next_page":"http:\/\/api.untappd.com\/v3\/brewery_search?q=stone&offset=25","results":[{"brewery_id":"1390","brewery_name":"Yellowstone Valley Brewing","brewery_stamp":"https:\/\/untappd.s3.amazonaws.com\/site\/assets\/images\/temp\/badge-brewery-default.png","country_name":"United States","top_beers":[{"beer_name":"Black Widow Oatmeal Stout","beer_id":"25976","beer_type":"Oatmeal Stout"}
54
+
55
+ # Brewery info JSON
56
+ # {"http_code":200,"results":{"name":"Pizza Beer","brewery_id":"1000","country":"United States","img":"https:\/\/untappd.s3.amazonaws.com\/site\/assets\/images\/temp\/badge-brewery-default.png","brewery_owner":"475","total_count":"5","unique_count":"5","monthly_count":"1","weekly_count":"0","top_beers":[{"beer_name":"Mamma Mia! Pizza Beer","beer_id":"4948","beer_type":"Herbed\/Spiced Beer"}],"twitter_handle":""}}
32
57
 
33
- #Brewery feed JSON
58
+ # Brewery feed JSON
34
59
  #{"next_query":"http:\/\/api.untappd.com\/v3\/brewery_checkins?brewery_id=1000&since=125187","next_page":"http:\/\/api.untappd.com\/v3\/brewery_checkins?brewery_id=1000&offset=25","http_code":200,"results":[{"user":{"user_name":"miamichael2","first_name":"Michael","last_name":"","user_avatar":"https:\/\/untappd.s3.amazonaws.com\/profile\/d05bf16dede98638c3521b157d12356d_thumb.JPG","location":"Miami","bio":"","is_friends":null,"url":null},"checkin_id":"617763","beer_id":"4948","brewery_id":"1000","beer_name":"Mamma Mia! Pizza Beer","brewery_name":"Pizza Beer","created_at":"Sat, 09 Apr 2011 03:34:32 +0000","check_in_comment":"A for effort and it really does smell and taste like pizza, but this is absolutely disgusting. http:\/\/flic.kr\/p\/9x1eC2","checkin_link":"http:\/\/untappd.com\/user\/miamichael2\/checkin\/617763","beer_stamp":"https:\/\/untappd.s3.amazonaws.com\/site\/assets\/images\/temp\/badge-beer-default.png","venue_name":"Midtown 2","venue_id":"38754","venue_lat":"25.8094","venue_lng":"-80.1915"},
@@ -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 = ["christopher.mar@gmail.com"]
10
+ s.email = ["chris@cmar.me"]
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
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-14 00:00:00 -04:00
18
+ date: 2011-04-18 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
- - christopher.mar@gmail.com
71
+ - chris@cmar.me
72
72
  executables: []
73
73
 
74
74
  extensions: []