Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
acmeyer committed Apr 4, 2013
1 parent 0ed8b88 commit d7b9906
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
13 changes: 12 additions & 1 deletion lib/foursquare2/venuegroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ module Venuegroups
#
# param [String] venuegroup_id The ID of the venue

def venue(venuegroup_id)
def venuegroup(venuegroup_id)
response = connection.get("venuegroups/#{venuegroup_id}")
return_error_or_body(response, response.body.response.venuegroup)
end

# Add a venuegroup
# @option options String :name - Required
# @option options String :venueId - If specified, a comma-delimited list of venue IDs that will become the new set of venue IDs for the group.

def add_venuegroup(options={})
response = connection.post do |req|
req.url "venuegroups/add", options
end
return_error_or_body(response, response.body.response.venuegroup)
end

# Update a venuegroup
# @param [String] group_id - The Id of the venuegroup you're updating (required)
# @param [Hash] options
Expand Down
8 changes: 0 additions & 8 deletions test/fixtures/campaigns/campaign.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
{
"meta": {"code": 200},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {
"campaign": {
"id": "4e0deba2922e6f94b1410b79",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/venuegroups/venuegroup_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"response": {
"venuegroup": {
"id": "4e15cd13b61c42e7c54e5bb6",
"name": "",
"name": "Venues",
"venues": {
"count": 2,
"items": [
Expand Down
6 changes: 6 additions & 0 deletions test/test_venuegroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ class TestVenuegroups < Test::Unit::TestCase
venuegroup.id == "4e15cd13b61c42e7c54e5bb6"
end

should "add a venuegroup" do
stub_post("https://api.foursquare.com/v2/venuegroups/add?oauth_token=#{@client.oauth_token}?name=Venues&venueId=4b8c3d87f964a520f7c532e3", "venuegroups/venuegroup.json")
venuegroup = @client.add_venuegroup()
venuegroup.name == "Venue"
end

should "update a venuegroup" do
stub_post("https://api.foursquare.com/v2/venuegroups/4e15cd13b61c42e7c54e5bb6/update?oauth_token=#{@client.oauth_token}?venueId=4b8c3d87f964a520f7c532e3,4d572bcc9e508cfab975189b", "venuegroups/venuegroup_update.json")
venuegroup = @client.venuegroup('4e15cd13b61c42e7c54e5bb6')
Expand Down

0 comments on commit d7b9906

Please sign in to comment.