skittles 0.5.0 → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  = Skittles
2
2
 
3
- Foursquare v2 REST API client library for Ruby
3
+ A Ruby implementation of the Foursquare v2 REST API. This library implements the Foursquare v2 API and the Foursquare Venues Project (beta) endpoints.
4
4
 
5
5
  == Documentation
6
6
 
@@ -15,5 +15,6 @@ module Skittles
15
15
  include Skittles::Client::Photo
16
16
  include Skittles::Client::Setting
17
17
  include Skittles::Client::Special
18
+ include Skittles::Client::List
18
19
  end
19
20
  end
@@ -0,0 +1,67 @@
1
+ module Skittles
2
+ class Client
3
+ # Define methods related to lists.
4
+ # @see https://developer.foursquare.com/docs/lists/lists.html
5
+ module List
6
+ def add_list(name, options = {})
7
+ post("lists/add", { :name => name }.merge(options)).list
8
+ end
9
+
10
+ # Gives detail about a list.
11
+ #
12
+ # @param id [String] The id of the list to retrieve additional information for.
13
+ # @return [Hashie::Mash] A list object.
14
+ # @requires_acting_user No
15
+ # @see https://developer.foursquare.com/docs/lists/lists.html
16
+ def list(id)
17
+ get("lists/#{id}").list
18
+ end
19
+
20
+ # Returns users following this list.
21
+ #
22
+ # @note Only valid on user-created lists.
23
+ # @param id [String] The id of the user created list to retrieve additional information for.
24
+ # @return [Hashie::Mash] A pageable list of compact user.
25
+ # @requires_acting_user Yes
26
+ # @see https://developer.foursquare.com/docs/lists/followers.html
27
+ def list_followers(id)
28
+ get("lists/#{id}/followers").followers
29
+ end
30
+
31
+ # Suggests venues that may be appropriate for this list.
32
+ #
33
+ # @note Only valid on user-created lists.
34
+ # @param id [String] The id of the user created list to retrieve additional information for.
35
+ # @return [Hashie::Mash] An array of compact venues.
36
+ # @requires_acting_user Yes
37
+ # @see https://developer.foursquare.com/docs/lists/suggestvenues.html
38
+ def list_suggestvenues(id)
39
+ get("lists/#{id}/suggestvenues").suggestedVenues
40
+ end
41
+
42
+ # Suggests photos that may be appropriate for this item.
43
+ #
44
+ # @note Only valid on user-created lists.
45
+ # @param list_id [String] The id of the user created list to retrieve additional information for.
46
+ # @param item_id [String] The id of the item to retrieve for a list.
47
+ # @return [Hashie::Mash] Returns groups user and others containing lists of photos.
48
+ # @requires_acting_user Yes
49
+ # @see https://developer.foursquare.com/docs/lists/suggestphoto.html
50
+ def list_suggestphoto(list_id, item_id)
51
+ get("lists/#{list_id}/suggestphoto", { :item_id => item_id }).photos
52
+ end
53
+
54
+ # Suggests tips that may be appropriate for this item.
55
+ #
56
+ # @note Only valid on user-created lists.
57
+ # @param list_id [String] The id of the user created list to retrieve additional information for.
58
+ # @param item_id [String] The id of the item to retrieve for a list.
59
+ # @return [Hashie::Mash] Returns groups user and others containing lists of photos.
60
+ # @requires_acting_user Yes
61
+ # @see https://developer.foursquare.com/docs/lists/suggesttip.html
62
+ def list_suggesttip(list_id, item_id)
63
+ get("lists/#{list_id}/suggesttip", { :item_id => item_id }).tips
64
+ end
65
+ end
66
+ end
67
+ end
@@ -25,6 +25,7 @@ module Skittles
25
25
  # @option options [String] tipId The ID of a tip owned by the user.
26
26
  # @option options [String] venueId The ID of a venue, provided only when adding a public photo of the venue in general, rather than a private checkin or tip photo using the parameters above.
27
27
  # @option options [String] broadcast Whether to broadcast this photo to twitter, facebook or both.
28
+ # @option options [Integer] Allows for a public photo and viewable at the venue. Valid values are 1 and 0 (default).
28
29
  # @option options [String] ll Latitude and longitude of the user's location.
29
30
  # @option options [Decimal] llAcc Accuracy of the user's latitude and longitude, in meters.
30
31
  # @option options [Decimal] alt Altitude of the user's location, in meters.
@@ -30,8 +30,21 @@ module Skittles
30
30
  get("tips/#{id}").tip
31
31
  end
32
32
 
33
+ # The lists that a tip appears on.
34
+ #
35
+ # @param id [String] The tip to get lists for.
36
+ # @param options [Hash] A customizable set of options.
37
+ # @option options [String] group Either created, edited, followed, friends or suggested.
38
+ # @return The lists a tip appears on.
39
+ # @require_acting_user Yes
40
+ # @see https://developer.foursquare.com/docs/tips/listed.html
41
+ def tip_listed(id, options = {})
42
+ get("tips/#{id}/listed", options).lists
43
+ end
44
+
33
45
  # Allows the acting user to mark a tip done.
34
46
  #
47
+ # @deprecated
35
48
  # @param id [String] The tip you want to mark done.
36
49
  # @return [Hashie::Mash] The marked to-do.
37
50
  # @requires_acting_user Yes
@@ -42,6 +55,7 @@ module Skittles
42
55
 
43
56
  # Allows you to mark a tip to-do.
44
57
  #
58
+ # @deprecated
45
59
  # @param id [String] The tip you want to mark to-do.
46
60
  # @return [Hashie::Mash] The newly-added to-do.
47
61
  # @requires_acting_user Yes
@@ -67,6 +81,7 @@ module Skittles
67
81
 
68
82
  # Allows you to remove a tip from your to-do list or done list.
69
83
  #
84
+ # @deprecated
70
85
  # @param id [String] The tip you want to unmark.
71
86
  # @return [Hashie::Mash] The tip being acted on.
72
87
  # @requires_acting_user No
@@ -94,14 +94,27 @@ module Skittles
94
94
  get('users/leaderboard').leaderboard
95
95
  end
96
96
 
97
+ # A user's lists.
98
+ #
99
+ # @param id [String] Identity of the user to get lists for. Pass self to get lists of the acting user.
100
+ # @param options [Hash] A customizable set of options.
101
+ # @option options [String] group Either created, edited, followed, friends or suggested.
102
+ # @option options[String] ll Latitude and longitude of the user's location.
103
+ # @return [Hashie::Mash] A user's lists.
104
+ # @requies_acting_user Yes
105
+ # @see https://developer.foursquare.com/docs/users/lists.html
106
+ def user_lists(id = 'self', options = {})
107
+ get("users/#{id}/lists", options).lists
108
+ end
109
+
97
110
  # Returns a user's mayorships
98
111
  #
99
- # @params user [String] Identity of the user to get mayorships for. Pass self to get friends of the acting user.
112
+ # @params id [String] Identity of the user to get mayorships for. Pass self to get friends of the acting user.
100
113
  # @return [Hashie::Mash] A count and items of objects which currently only contain compact venue objects.
101
114
  # @requires_acting_user Yes
102
115
  # @see https://developer.foursquare.com/docs/users/mayorships.html
103
- def mayorships(user = 'self')
104
- get("users/#{user}/mayorships").mayorships
116
+ def mayorships(id = 'self')
117
+ get("users/#{id}/mayorships").mayorships
105
118
  end
106
119
 
107
120
  # Changes whether the acting user will receive pings (phone
@@ -118,6 +131,7 @@ module Skittles
118
131
 
119
132
  # Returns todos from a user.
120
133
  #
134
+ # @deprecated
121
135
  # @param id Identity of the user to get todos for. Pass self to get todos of the acting user.
122
136
  # @param sort One of recent or popular. Nearby requires geolat and geolong to be provided.
123
137
  # @param options [Hash] A customizable set of options.
@@ -166,7 +180,7 @@ module Skittles
166
180
  # @return [Hashie::Mash] Profile information for a given user.
167
181
  # @requires_acting_user Yes
168
182
  # @see http://developer.foursquare.com/docs/users/users.html
169
- def user(id)
183
+ def user(id = 'self')
170
184
  get("users/#{id}").user
171
185
  end
172
186
 
@@ -199,6 +213,7 @@ module Skittles
199
213
 
200
214
  # Returns tips from a user.
201
215
  #
216
+ # @deprecated
202
217
  # @param id [String] Identity of the user to get tips from. Pass self to get tips of the acting user.
203
218
  # @option options [Hash] A customizable set of options.
204
219
  # @option options [String] sort One of recent, nearby, or popular. Nearby requires geolat and geolong to be provided.
@@ -55,11 +55,12 @@ module Skittles
55
55
  # @option options [Decimal] llAcc Accuracy of latitude and longitude, in meters.
56
56
  # @option options [Decimal] alt Altitude of the user's location, in meters.
57
57
  # @option options [Decimal] altAcc Accuracy of the user's altitude, in meters.
58
- # @option radius [Integer] Radius to search within, in meters.
59
- # @option section [String] One of food, drinks, coffee, shops, or arts. Limits results to venues with categories matching these terms.
60
- # @option query [String] A search term to be applies against tips, category tips, etc. at a venue.
61
- # @option limit [Integer] Number of results to return, up to 50.
62
- # @option basis [String] If present and set to friends or me, limits results to only places where friends have visited or user has visited, respectively.
58
+ # @option options radius [Integer] Radius to search within, in meters.
59
+ # @option options section [String] One of food, drinks, coffee, shops, or arts. Limits results to venues with categories matching these terms.
60
+ # @option options query [String] A search term to be applies against tips, category tips, etc. at a venue.
61
+ # @option options limit [Integer] Number of results to return, up to 50.
62
+ # @option options basis [String] If present and set to friends or me, limits results to only places where friends have visited or user has visited, respectively.
63
+ # @option options [String] novelty Pass new or old to limit results to places the acting user hasn't been or has been, respectively. Omitting this parameter returns a mixture.
63
64
  # @return [Hashie::Mash] Response fields keywords, warnings and groups.
64
65
  # @requires_acting_user No
65
66
  # @see https://developer.foursquare.com/docs/venues/explore.html
@@ -168,6 +169,10 @@ module Skittles
168
169
  get("venues/#{id}").venue
169
170
  end
170
171
 
172
+ def venue_events(id)
173
+ get("venues/#{id}/events").events
174
+ end
175
+
171
176
  # Returns URLs or identifier from third parties that have been applied to this
172
177
  # venue.
173
178
  #
@@ -180,8 +185,21 @@ module Skittles
180
185
  get("venues/#{id}/links").links
181
186
  end
182
187
 
188
+ # The lists that a venue appears on.
189
+ #
190
+ # @param id [String] The venue to get lists for.
191
+ # @param options [Hash] A customizable set of options.
192
+ # @option options [String] group Either created, edited, followed, friends or suggested.
193
+ # @return [Hashie::Mash] The lists a venue appears on.
194
+ # @requies_acting_user Yes
195
+ # @see https://developer.foursquare.com/docs/venues/listed.html
196
+ def venue_listed(id, options = {})
197
+ get("venues/#{id}/listed", options).lists
198
+ end
199
+
183
200
  # Allows a user to mark a venue to-do, with optional text.
184
201
  #
202
+ # @deprecated
185
203
  # @param id The venue you want to mark to-do.
186
204
  # @param options [Hash] A customizable set of options.
187
205
  # @option options [String] text The text of the tip.
@@ -207,6 +225,9 @@ module Skittles
207
225
  # @option options [String] query A search term to be applied against titles.
208
226
  # @option options [Integer] limit Number of results to return, up to 50.
209
227
  # @option options [String] intent Indicates your intent in performing the search.
228
+ # @option options [Integer] radius Limit results to venues within this many meters of the specified location.
229
+ # @option options [Decimal] sw With ne, limits results to the bounding quadrangle defined by the latitude and longitude given by sw as its south-west corner, and ne as its north-east corner.
230
+ # @option options [Decimal] ne See sw
210
231
  # @option options [String] categoryId A category to limit the results to. (experimental)
211
232
  # @option options [String] url A third-party URL which is attempted to match against a map of venues to URLs. (experimental)
212
233
  # @option options [String] providerId Identifier for a known third party that is part of a map of venues to URLs, used in conjunction with linkedId. (experimental)
@@ -218,6 +239,10 @@ module Skittles
218
239
  get('venues/search', { :ll => ll }.merge(options)).venues
219
240
  end
220
241
 
242
+ def venue_suggestcompletion(ll, query, options = {})
243
+ get('venues/suggestcompletion', { :ll => ll, :query => query }.merge(options)).minivenues
244
+ end
245
+
221
246
  # Returns tips for a venue.
222
247
  #
223
248
  # @param id [String] The venue you want tips for.
@@ -5,14 +5,11 @@ module Skittles
5
5
  module Connection
6
6
  private
7
7
  def connection
8
- options = {
9
- :site => endpoint
10
- }
11
- puts
12
- client = OAuth2::Client.new(client_id, client_secret, options)
13
- oauth_token = OAuth2::AccessToken.new(client, access_token)
14
-
15
- oauth_token.token_param = 'oauth_token'
8
+ client = OAuth2::Client.new(client_id, client_secret, { :site => endpoint })
9
+ oauth_token = OAuth2::AccessToken.new(client, access_token, {
10
+ :mode => :query,
11
+ :param_name => 'oauth_token'
12
+ })
16
13
  oauth_token
17
14
  end
18
15
  end
@@ -42,14 +42,14 @@ module Skittles
42
42
 
43
43
  begin
44
44
  response = connection.request(method, paramify(path, options), headers)
45
- rescue OAuth2::ErrorWithResponse => e
45
+ rescue OAuth2::Error => e
46
46
  Skittles::Utils.handle_foursquare_error(e.response)
47
47
  else
48
48
  Skittles::Error
49
49
  end
50
50
 
51
51
  unless raw
52
- result = Skittles::Utils.parse_json(response)
52
+ result = Skittles::Utils.parse_json(response.body)
53
53
  end
54
54
 
55
55
  raw ? response : result.response
@@ -1,3 +1,3 @@
1
1
  module Skittles
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skittles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,88 +9,88 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-29 00:00:00.000000000Z
12
+ date: 2011-11-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
16
- requirement: &70223019913040 !ruby/object:Gem::Requirement
16
+ requirement: &70111005888740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.4.1
21
+ version: 0.5.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70223019913040
24
+ version_requirements: *70111005888740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yajl-ruby
27
- requirement: &70223019912560 !ruby/object:Gem::Requirement
27
+ requirement: &70111005888240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.1
32
+ version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70223019912560
35
+ version_requirements: *70111005888240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &70223019912080 !ruby/object:Gem::Requirement
38
+ requirement: &70111005887720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 1.0.0
43
+ version: 1.2.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70223019912080
46
+ version_requirements: *70111005887720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mime-types
49
- requirement: &70223019911600 !ruby/object:Gem::Requirement
49
+ requirement: &70111005887200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: 1.17.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70223019911600
57
+ version_requirements: *70111005887200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70223019911120 !ruby/object:Gem::Requirement
60
+ requirement: &70111005865060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 2.5.0
65
+ version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70223019911120
68
+ version_requirements: *70111005865060
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70223019910640 !ruby/object:Gem::Requirement
71
+ requirement: &70111005864540 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
- - - ~>
74
+ - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
- version: 1.0.15
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70223019910640
79
+ version_requirements: *70111005864540
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &70223019910160 !ruby/object:Gem::Requirement
82
+ requirement: &70111005863280 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
- - - ~>
85
+ - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
- version: 1.6.4
87
+ version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70223019910160
90
+ version_requirements: *70111005863280
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rcov
93
- requirement: &70223019909680 !ruby/object:Gem::Requirement
93
+ requirement: &70111005862800 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,18 +98,18 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70223019909680
101
+ version_requirements: *70111005862800
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: yard
104
- requirement: &70223019909200 !ruby/object:Gem::Requirement
104
+ requirement: &70111005862240 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ~>
107
+ - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.7.2
109
+ version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70223019909200
112
+ version_requirements: *70111005862240
113
113
  description: A Ruby implementation of the Foursquare v2 REST API. This library implements
114
114
  the Foursquare v2 API and the Foursquare Venues Project (beta) endpoints.
115
115
  email: anthony@sticksnleaves.com
@@ -123,6 +123,7 @@ files:
123
123
  - lib/skittles/api.rb
124
124
  - lib/skittles/client.rb
125
125
  - lib/skittles/client/checkin.rb
126
+ - lib/skittles/client/list.rb
126
127
  - lib/skittles/client/photo.rb
127
128
  - lib/skittles/client/setting.rb
128
129
  - lib/skittles/client/special.rb
@@ -152,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
153
  version: '0'
153
154
  segments:
154
155
  - 0
155
- hash: 3746734199987061722
156
+ hash: -794761221278105416
156
157
  required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  none: false
158
159
  requirements:
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  version: '0'
162
163
  requirements: []
163
164
  rubyforge_project:
164
- rubygems_version: 1.8.6
165
+ rubygems_version: 1.8.10
165
166
  signing_key:
166
167
  specification_version: 3
167
168
  summary: Foursquare v2 REST API client library for Ruby