john-mayer 0.0.12 → 0.1.0

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.
@@ -27,6 +27,18 @@ module Foursquare
27
27
  response["meta"]["errorType"] ? error(response) : response["response"]
28
28
  end
29
29
 
30
+ def post(path, params={})
31
+ params = params.inject({}) { |o, (k, v)|
32
+ o[k.to_s.gsub(/(_[a-z])/) { |m| m[1..1].upcase }] = v
33
+ o
34
+ } # Camelize them params.
35
+ Foursquare.log("POST #{API + path}")
36
+ params.merge!(:oauth_token => @access_token)
37
+ response = JSON.parse(Typhoeus::Request.post(API + path, :params => params).body)
38
+ Foursquare.log(response.inspect)
39
+ response["meta"]["errorType"] ? error(response) : response["response"]
40
+ end
41
+
30
42
  private
31
43
 
32
44
  def error(response)
@@ -19,5 +19,13 @@ module Foursquare
19
19
  Foursquare::Checkin.new(@foursquare, json)
20
20
  end
21
21
  end
22
+
23
+ def create(options={})
24
+ if json = @foursquare.post("checkins/add", options)
25
+ Foursquare::Checkin.new(@foursquare, json["checkin"])
26
+ else
27
+ nil
28
+ end
29
+ end
22
30
  end
23
31
  end
data/test.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'lib/foursquare'
2
2
 
3
- FOURSQUARE = Foursquare::Base.new('YSQQ2G4HOATU5515IFH4ODCKUQYYKZ2M4DVBNPI1ZCXKL3QS')
3
+ # FOURSQUARE = Foursquare::Base.new('YSQQ2G4HOATU5515IFH4ODCKUQYYKZ2M4DVBNPI1ZCXKL3QS')
4
+ FOURSQUARE = Foursquare::Base.new('T2UPWWBXJP2UFBRTBXKDM1UQAH3A3TUDELQ3YQRFAWGLKTTT')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: john-mayer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 12
10
- version: 0.0.12
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Nakajima