Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added ability to perform likes and add comments

Endpoint reorganizations and some internal renaming
Bump to 0.1
  • Loading branch information...
commit 9afde9926daee84717f7a297375cf0461eea55d7 1 parent e7e46c6
Shayne Sweeney authored
View
2  README.md
@@ -69,7 +69,7 @@ API Usage Examples
require "instagram"
# Get a list of a user's most recent media
- puts Instagram.user_recent_media(1234)
+ puts Instagram.user_recent_media(777)
# Get the currently authenticated user's media feed
puts Instagram.user_media_feed
View
8 lib/instagram/client.rb
@@ -8,9 +8,11 @@ class Client < API
include Instagram::Client::Utils
- include Instagram::Client::User
+ include Instagram::Client::Users
include Instagram::Client::Media
- include Instagram::Client::Location
- include Instagram::Client::Tag
+ include Instagram::Client::Locations
+ include Instagram::Client::Tags
+ include Instagram::Client::Comments
+ include Instagram::Client::Likes
end
end
View
44 lib/instagram/client/comments.rb
@@ -0,0 +1,44 @@
+module Instagram
+ class Client
+ # Defines methods related to comments
+ module Comments
+ # Returns a list of comments for a given media item ID
+ #
+ # @overload media_comments(id)
+ # @param id [Integer] An Instagram media item ID
+ # @return [Hashie::Mash] The requested comment.
+ # @example Returns a list of comments for the media item of ID 1234
+ # Instagram.media_comments(777)
+ # @format :json
+ # @authenticated true
+ #
+ # If getting this data of a protected user, you must be authenticated (and be allowed to see that user).
+ # @rate_limited true
+ # @see TODO:docs url
+ def media_comments(id, *args)
+ response = get("media/#{id}/comments")
+ response["data"]
+ end
+
+ # Create's a comment for a given media item ID
+ #
+ # @overload create_media_comment(id, text)
+ # @param id [Integer] An Instagram media item ID
+ # @param text [String] The text of your comment
+ # @return [Hashie::Mash] The comment created.
+ # @example Creates a new comment on media item with ID 777
+ # Instagram.create_media_comment(777, "Oh noes!")
+ # @format :json
+ # @authenticated true
+ #
+ # If getting this data of a protected user, you must be authenticated (and be allowed to see that user).
+ # @rate_limited true
+ # @see TODO:docs url
+ def create_media_comment(id, text, options={})
+ response = post("media/#{id}/comments", options.merge(:text => text))
+ response["data"]
+ end
+
+ end
+ end
+end
View
42 lib/instagram/client/likes.rb
@@ -0,0 +1,42 @@
+module Instagram
+ class Client
+ # Defines methods related to likes
+ module Likes
+ # Returns a list of users who like a given media item ID
+ #
+ # @overload media_likes(id)
+ # @param media [Integer] An Instagram media item ID
+ # @return [Hashie::Mash] A list of users.
+ # @example Returns a list of users who like the media item of ID 1234
+ # Instagram.media_likes(777)
+ # @format :json
+ # @authenticated true
+ #
+ # If getting this data of a protected user, you must be authenticated (and be allowed to see that user).
+ # @rate_limited true
+ # @see TODO:docs url
+ def media_likes(id, *args)
+ response = get("media/#{id}/likes")
+ response["data"]
+ end
+
+ # Issues a like by the currently authenticated user, for a given media item ID
+ #
+ # @overload like_media(id, text)
+ # @param id [Integer] An Instagram media item ID
+ # @return [Hashie::Mash] The user who performed the like.
+ # @example Like media item with ID 777
+ # Instagram.like_media(777)
+ # @format :json
+ # @authenticated true
+ #
+ # If getting this data of a protected user, you must be authenticated (and be allowed to see that user).
+ # @rate_limited true
+ # @see TODO:docs url
+ def like_media(id, options={})
+ response = post("media/#{id}/likes", options)
+ response["data"]
+ end
+ end
+ end
+end
View
6 lib/instagram/client/location.rb → lib/instagram/client/locations.rb
@@ -1,7 +1,7 @@
module Instagram
class Client
# Defines methods related to media items
- module Location
+ module Locations
# Returns extended information of a given Instagram location
#
# @overload location(id)
@@ -15,7 +15,7 @@ module Location
# @see TODO:docs url
def location(id, *args)
response = get("locations/#{id}")
- response['data']
+ response["data"]
end
# Returns a list of recent media items for a given Instagram location
@@ -52,7 +52,7 @@ def location_recent_media(id, *args)
# @rate_limited true
def location_search(lat, lng, options={})
response = get('locations/search', options.merge(:lat => lat, :lng => lng))
- response['data']
+ response["data"]
end
end
end
View
23 lib/instagram/client/media.rb
@@ -18,26 +18,7 @@ module Media
def media_item(*args)
id = args.first || 'self'
response = get("media/#{id}")
- response['data']
- end
-
- # Returns a list of users who liked the given media object
- #
- # @overload media_item_likers(id)
- # @param user [Integer] An Instagram media item ID
- # @return [Hashie::Mash] The requested media item.
- # @example Return a list of all the likers for media item ID 1234
- # Instagram.media_item_likers(1324)
- # @format :json
- # @authenticated false unless requesting media from a protected user
- #
- # If getting this data of a protected user, you must authenticate (and be allowed to see that user).
- # @rate_limited true
- # @see TODO:docs url
- def media_item_likers(*args)
- id = args.first || 'self'
- response = get("media/#{id}/likers")
- response['data']
+ response["data"]
end
# Returns a list of the overall most popular media
@@ -75,7 +56,7 @@ def media_popular(*args)
# @rate_limited true
def media_search(lat, lng, options={})
response = get('media/search', options.merge(:lat => lat, :lng => lng))
- response['data']
+ response["data"]
end
end
end
View
6 lib/instagram/client/tag.rb → lib/instagram/client/tags.rb
@@ -1,7 +1,7 @@
module Instagram
class Client
# Defines methods related to tags
- module Tag
+ module Tags
# Returns extended information of a given Instagram tag
#
# @overload tag(tag)
@@ -15,7 +15,7 @@ module Tag
# @see TODO:docs url
def tag(tag, *args)
response = get("tags/#{tag}")
- response['data']
+ response["data"]
end
# Returns a list of recent media items for a given Instagram tag
@@ -52,7 +52,7 @@ def tag_recent_media(id, *args)
# Instagram.tag_search("cat")
def tag_search(query, options={})
response = get('tags/search', options.merge(:q => query))
- response['data']
+ response["data"]
end
end
end
View
10 lib/instagram/client/user.rb → lib/instagram/client/users.rb
@@ -1,7 +1,7 @@
module Instagram
class Client
# Defines methods related to users
- module User
+ module Users
# Returns extended information of a given user
#
# @overload user(id=nil, options={})
@@ -18,7 +18,7 @@ module User
def user(*args)
id = args.first || 'self'
response = get("users/#{id}")
- response['data']
+ response["data"]
end
# Returns users that match the given query
@@ -35,7 +35,7 @@ def user(*args)
# Instagram.user_search("Shayne Sweeney")
def user_search(query, options={})
response = get('users/search', options.merge(:q => query))
- response['data']
+ response["data"]
end
# Returns a list of users whom a given user follows
@@ -62,7 +62,7 @@ def user_search(query, options={})
def user_follows(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
id = args.first || "self"
- response = get("users/#{id}/follows/users", options)
+ response = get("users/#{id}/follows", options)
response["data"]
end
end
@@ -91,7 +91,7 @@ def user_follows(*args)
def user_followed_by(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
id = args.first || "self"
- response = get("users/#{id}/followed-by/users", options)
+ response = get("users/#{id}/followed-by", options)
response["data"]
end
View
14 lib/instagram/request.rb
@@ -10,6 +10,16 @@ def get(path, options={}, raw=false, unformatted=false)
def post(path, options={}, raw=false, unformatted=false)
request(:post, path, options, raw, unformatted)
end
+
+ # Perform an HTTP PUT request
+ def put(path, options={}, raw=false, unformatted=false)
+ request(:put, path, options, raw, unformatted)
+ end
+
+ # Perform an HTTP DELETE request
+ def delete(path, options={}, raw=false, unformatted=false)
+ request(:delete, path, options, raw, unformatted)
+ end
private
@@ -18,9 +28,9 @@ def request(method, path, options, raw=false, unformatted=false)
response = connection(raw).send(method) do |request|
path = formatted_path(path) unless unformatted
case method
- when :get
+ when :get, :delete
request.url(path, options)
- when :post
+ when :post, :put
request.path = path
request.body = options unless options.empty?
end
View
2  lib/instagram/version.rb
@@ -1,3 +1,3 @@
module Instagram
- VERSION = '0.0.1'.freeze unless defined?(::Instagram::VERSION)
+ VERSION = '0.1'.freeze unless defined?(::Instagram::VERSION)
end
View
2  spec/fixtures/followed_by.json
@@ -1 +1 @@
-{"paging": {"next": "http://api_privatebeta.instagr.am/api/v2/users/20/followed-by/users?access_token=f59def8.001cde77128843169627c0308237bafa&cursor=19490800"}, "meta": {"code": 200}, "data": [{"username": "bojieyang", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1776468}, {"username": "samanthadelaide", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774434_75sq_1296575655.jpg", "id": 1774434}, {"username": "aericangelo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_831982_75sq_1291903923.jpg", "id": 831982}, {"username": "arosa13", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_99215_75sq_1295887470.jpg", "id": 99215}, {"username": "prensessa", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_42309_75sq_1286603395.jpg", "id": 42309}, {"username": "hibarista", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775803_75sq_1296583859.jpg", "id": 1775803}, {"username": "g_e_m", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770129_75sq_1296548465.jpg", "id": 1770129}, {"username": "stephybear987", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775658_75sq_1296582616.jpg", "id": 1775658}, {"username": "henshin", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1646136}, {"username": "misunkim", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775480_75sq_1296581465.jpg", "id": 1775480}, {"username": "wikipediakid", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775261_75sq_1296580075.jpg", "id": 1775261}, {"username": "anmolm", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775158_75sq_1296579533.jpg", "id": 1775158}, {"username": "5f", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1757297_75sq_1296472161.jpg", "id": 1757297}, {"username": "jmo28", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774978_75sq_1296578473.jpg", "id": 1774978}, {"username": "docfranzke", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1079120_75sq_1294650560.jpg", "id": 1079120}, {"username": "kussarah", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774841}, {"username": "migup", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_218331_75sq_1291410648.jpg", "id": 218331}, {"username": "keruri", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774807_75sq_1296577696.jpg", "id": 1774807}, {"username": "krittakorn", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774715_75sq_1296577203.jpg", "id": 1774715}, {"username": "saviou", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774698}, {"username": "jjfoxhound", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774666_75sq_1296576925.jpg", "id": 1774666}, {"username": "henryedaz", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1068785_75sq_1292704467.jpg", "id": 1068785}, {"username": "dottsboo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774626_75sq_1296576746.jpg", "id": 1774626}, {"username": "gogoheadbritt", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774542}, {"username": "freakiinkidd13", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774458}, {"username": "dhd", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774255_75sq_1296574807.jpg", "id": 1774255}, {"username": "ultimatekbox", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774161_75sq_1296574308.jpg", "id": 1774161}, {"username": "laurelhope", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773922_75sq_1296574116.jpg", "id": 1773922}, {"username": "fearmytofu", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1756478_75sq_1296466626.jpg", "id": 1756478}, {"username": "crystal_faith", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773314_75sq_1296569794.jpg", "id": 1773314}, {"username": "jingmaili", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1773236}, {"username": "geeishanaate76", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773147_75sq_1296568942.jpg", "id": 1773147}, {"username": "lyling82", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1772900}, {"username": "beccanash", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772861_75sq_1296569585.jpg", "id": 1772861}, {"username": "santah", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772796_75sq_1296567010.jpg", "id": 1772796}, {"username": "locaflower", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771328_75sq_1296557612.jpg", "id": 1771328}, {"username": "yrq", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772320_75sq_1296564304.jpg", "id": 1772320}, {"username": "jamielacerda", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1238760_75sq_1296564659.jpg", "id": 1238760}, {"username": "official_cat", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_218642_75sq_1294783335.jpg", "id": 218642}, {"username": "richurlex", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1771923}, {"username": "sarahleeeleonore", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1771896}, {"username": "faxvaag", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1122606_75sq_1293791250.jpg", "id": 1122606}, {"username": "makistyle", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1738402_75sq_1296370804.jpg", "id": 1738402}, {"username": "cuthers87", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771277_75sq_1296557172.jpg", "id": 1771277}, {"username": "jadekang", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771054_75sq_1296555429.jpg", "id": 1771054}, {"username": "thelostbear", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770958_75sq_1296554737.jpg", "id": 1770958}, {"username": "elf826", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770898_75sq_1296554267.jpg", "id": 1770898}, {"username": "cameronwarhol", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1770793}, {"username": "krawcurulez", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1770765}, {"username": "harrislakers", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770505_75sq_1296551431.jpg", "id": 1770505}]}
+{"paging": {"next": "http://api_privatebeta.instagr.am/api/v2/users/20/followed-by?access_token=f59def8.001cde77128843169627c0308237bafa&cursor=19490800"}, "meta": {"code": 200}, "data": [{"username": "bojieyang", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1776468}, {"username": "samanthadelaide", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774434_75sq_1296575655.jpg", "id": 1774434}, {"username": "aericangelo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_831982_75sq_1291903923.jpg", "id": 831982}, {"username": "arosa13", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_99215_75sq_1295887470.jpg", "id": 99215}, {"username": "prensessa", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_42309_75sq_1286603395.jpg", "id": 42309}, {"username": "hibarista", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775803_75sq_1296583859.jpg", "id": 1775803}, {"username": "g_e_m", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770129_75sq_1296548465.jpg", "id": 1770129}, {"username": "stephybear987", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775658_75sq_1296582616.jpg", "id": 1775658}, {"username": "henshin", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1646136}, {"username": "misunkim", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775480_75sq_1296581465.jpg", "id": 1775480}, {"username": "wikipediakid", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775261_75sq_1296580075.jpg", "id": 1775261}, {"username": "anmolm", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1775158_75sq_1296579533.jpg", "id": 1775158}, {"username": "5f", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1757297_75sq_1296472161.jpg", "id": 1757297}, {"username": "jmo28", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774978_75sq_1296578473.jpg", "id": 1774978}, {"username": "docfranzke", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1079120_75sq_1294650560.jpg", "id": 1079120}, {"username": "kussarah", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774841}, {"username": "migup", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_218331_75sq_1291410648.jpg", "id": 218331}, {"username": "keruri", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774807_75sq_1296577696.jpg", "id": 1774807}, {"username": "krittakorn", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774715_75sq_1296577203.jpg", "id": 1774715}, {"username": "saviou", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774698}, {"username": "jjfoxhound", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774666_75sq_1296576925.jpg", "id": 1774666}, {"username": "henryedaz", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1068785_75sq_1292704467.jpg", "id": 1068785}, {"username": "dottsboo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774626_75sq_1296576746.jpg", "id": 1774626}, {"username": "gogoheadbritt", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774542}, {"username": "freakiinkidd13", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1774458}, {"username": "dhd", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774255_75sq_1296574807.jpg", "id": 1774255}, {"username": "ultimatekbox", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1774161_75sq_1296574308.jpg", "id": 1774161}, {"username": "laurelhope", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773922_75sq_1296574116.jpg", "id": 1773922}, {"username": "fearmytofu", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1756478_75sq_1296466626.jpg", "id": 1756478}, {"username": "crystal_faith", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773314_75sq_1296569794.jpg", "id": 1773314}, {"username": "jingmaili", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1773236}, {"username": "geeishanaate76", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1773147_75sq_1296568942.jpg", "id": 1773147}, {"username": "lyling82", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1772900}, {"username": "beccanash", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772861_75sq_1296569585.jpg", "id": 1772861}, {"username": "santah", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772796_75sq_1296567010.jpg", "id": 1772796}, {"username": "locaflower", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771328_75sq_1296557612.jpg", "id": 1771328}, {"username": "yrq", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1772320_75sq_1296564304.jpg", "id": 1772320}, {"username": "jamielacerda", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1238760_75sq_1296564659.jpg", "id": 1238760}, {"username": "official_cat", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_218642_75sq_1294783335.jpg", "id": 218642}, {"username": "richurlex", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1771923}, {"username": "sarahleeeleonore", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1771896}, {"username": "faxvaag", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1122606_75sq_1293791250.jpg", "id": 1122606}, {"username": "makistyle", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1738402_75sq_1296370804.jpg", "id": 1738402}, {"username": "cuthers87", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771277_75sq_1296557172.jpg", "id": 1771277}, {"username": "jadekang", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1771054_75sq_1296555429.jpg", "id": 1771054}, {"username": "thelostbear", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770958_75sq_1296554737.jpg", "id": 1770958}, {"username": "elf826", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770898_75sq_1296554267.jpg", "id": 1770898}, {"username": "cameronwarhol", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1770793}, {"username": "krawcurulez", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1770765}, {"username": "harrislakers", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1770505_75sq_1296551431.jpg", "id": 1770505}]}
View
2  spec/fixtures/follows.json
@@ -1 +1 @@
-{"paging": {"next": "http://api_privatebeta.instagr.am/api/v2/users/20/follows/users?access_token=f59def8.001cde77128843169627c0308237bafa&q=Shayne+Sweeney&cursor=10906239"}, "meta": {"code": 200}, "data": [{"username": "heartsf", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_814223_75sq_1295678065.jpg", "id": 814223}, {"username": "sbtesol", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1676861}, {"username": "themark42", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1683782}, {"username": "klyons", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1703903_75sq_1296314135.jpg", "id": 1703903}, {"username": "garyvee", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1697296_75sq_1296158123.jpg", "id": 1697296}, {"username": "bizstone", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_41348_75sq_1293327839.jpg", "id": 41348}, {"username": "dangelo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3290_75sq_1292749774.jpg", "id": 3290}, {"username": "suicidegirls", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1186880_75sq_1295581034.jpg", "id": 1186880}, {"username": "jayzombie", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_95_75sq_1294674528.jpg", "id": 95}, {"username": "thegrammys", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1352742_75sq_1294269333.jpg", "id": 1352742}, {"username": "cnnireport", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1321522_75sq_1294085544.jpg", "id": 1321522}, {"username": "youtube", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1337343_75sq_1295052152.jpg", "id": 1337343}, {"username": "redbull", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_476322_75sq_1288938542.jpg", "id": 476322}, {"username": "rabidsloth", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 975392}, {"username": "nkanemoto", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1119179}, {"username": "svanhout", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1578415_75sq_1295492261.jpg", "id": 1578415}, {"username": "kerryd82", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_465287_75sq_1293301958.jpg", "id": 465287}, {"username": "jalter", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.png", "id": 51}, {"username": "brieanemarie", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1557158_75sq_1295377730.jpg", "id": 1557158}, {"username": "fordryan", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1153542}, {"username": "snoopdogg", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg", "id": 1574083}, {"username": "kamalravikant", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1491754_75sq_1295074336.jpg", "id": 1491754}, {"username": "tenniscrook", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1502560}, {"username": "dougreg", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1424698}, {"username": "maria", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_60_75sq_1286907839.jpg", "id": 60}, {"username": "weldthisone", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1431100}, {"username": "nickb2400", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1118518}, {"username": "sarasiri", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 123324}, {"username": "yarnell", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 108894}, {"username": "atebits", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1294612_75sq_1294105539.jpg", "id": 1294612}, {"username": "julien51", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 115583}, {"username": "starbucks", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1034466_75sq_1293144108.jpg", "id": 1034466}, {"username": "doug", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_17_75sq_1292890348.jpg", "id": 17}, {"username": "nbcnews", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1269598_75sq_1294082789.jpg", "id": 1269598}, {"username": "evospeedracer", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1328298_75sq_1294120971.jpg", "id": 1328298}, {"username": "npr", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1258618_75sq_1293821873.jpg", "id": 1258618}, {"username": "mikeintampa", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1266404}, {"username": "sammienicole", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1262271_75sq_1295626361.jpg", "id": 1262271}, {"username": "mackieleigh", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1262165_75sq_1293816876.jpg", "id": 1262165}, {"username": "ntnl", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_622967_75sq_1289527600.jpg", "id": 622967}, {"username": "crippledpetey", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_908190_75sq_1293602628.jpg", "id": 908190}, {"username": "naveen", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_79_75sq_1284678395.jpg", "id": 79}, {"username": "labusque", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_357541_75sq_1288491953.jpg", "id": 357541}, {"username": "roach0123", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1150120_75sq_1295804260.jpg", "id": 1150120}, {"username": "markmanduca", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1153220_75sq_1293250587.jpg", "id": 1153220}, {"username": "dianeveronica", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_545015_75sq_1289176716.jpg", "id": 545015}, {"username": "leahmariebrooks", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1146978}, {"username": "cassiesweeney", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1137873_75sq_1293162628.jpg", "id": 1137873}, {"username": "parallaxchico", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1139928_75sq_1293175329.jpg", "id": 1139928}, {"username": "om", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_2637_75sq_1286977009.jpg", "id": 2637}]}
+{"paging": {"next": "http://api_privatebeta.instagr.am/api/v2/users/20/follows?access_token=f59def8.001cde77128843169627c0308237bafa&q=Shayne+Sweeney&cursor=10906239"}, "meta": {"code": 200}, "data": [{"username": "heartsf", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_814223_75sq_1295678065.jpg", "id": 814223}, {"username": "sbtesol", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1676861}, {"username": "themark42", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1683782}, {"username": "klyons", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1703903_75sq_1296314135.jpg", "id": 1703903}, {"username": "garyvee", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1697296_75sq_1296158123.jpg", "id": 1697296}, {"username": "bizstone", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_41348_75sq_1293327839.jpg", "id": 41348}, {"username": "dangelo", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3290_75sq_1292749774.jpg", "id": 3290}, {"username": "suicidegirls", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1186880_75sq_1295581034.jpg", "id": 1186880}, {"username": "jayzombie", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_95_75sq_1294674528.jpg", "id": 95}, {"username": "thegrammys", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1352742_75sq_1294269333.jpg", "id": 1352742}, {"username": "cnnireport", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1321522_75sq_1294085544.jpg", "id": 1321522}, {"username": "youtube", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1337343_75sq_1295052152.jpg", "id": 1337343}, {"username": "redbull", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_476322_75sq_1288938542.jpg", "id": 476322}, {"username": "rabidsloth", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 975392}, {"username": "nkanemoto", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1119179}, {"username": "svanhout", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1578415_75sq_1295492261.jpg", "id": 1578415}, {"username": "kerryd82", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_465287_75sq_1293301958.jpg", "id": 465287}, {"username": "jalter", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.png", "id": 51}, {"username": "brieanemarie", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1557158_75sq_1295377730.jpg", "id": 1557158}, {"username": "fordryan", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1153542}, {"username": "snoopdogg", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg", "id": 1574083}, {"username": "kamalravikant", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1491754_75sq_1295074336.jpg", "id": 1491754}, {"username": "tenniscrook", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1502560}, {"username": "dougreg", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1424698}, {"username": "maria", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_60_75sq_1286907839.jpg", "id": 60}, {"username": "weldthisone", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1431100}, {"username": "nickb2400", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1118518}, {"username": "sarasiri", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 123324}, {"username": "yarnell", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 108894}, {"username": "atebits", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1294612_75sq_1294105539.jpg", "id": 1294612}, {"username": "julien51", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 115583}, {"username": "starbucks", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1034466_75sq_1293144108.jpg", "id": 1034466}, {"username": "doug", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_17_75sq_1292890348.jpg", "id": 17}, {"username": "nbcnews", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1269598_75sq_1294082789.jpg", "id": 1269598}, {"username": "evospeedracer", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1328298_75sq_1294120971.jpg", "id": 1328298}, {"username": "npr", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1258618_75sq_1293821873.jpg", "id": 1258618}, {"username": "mikeintampa", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1266404}, {"username": "sammienicole", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1262271_75sq_1295626361.jpg", "id": 1262271}, {"username": "mackieleigh", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1262165_75sq_1293816876.jpg", "id": 1262165}, {"username": "ntnl", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_622967_75sq_1289527600.jpg", "id": 622967}, {"username": "crippledpetey", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_908190_75sq_1293602628.jpg", "id": 908190}, {"username": "naveen", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_79_75sq_1284678395.jpg", "id": 79}, {"username": "labusque", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_357541_75sq_1288491953.jpg", "id": 357541}, {"username": "roach0123", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1150120_75sq_1295804260.jpg", "id": 1150120}, {"username": "markmanduca", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1153220_75sq_1293250587.jpg", "id": 1153220}, {"username": "dianeveronica", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_545015_75sq_1289176716.jpg", "id": 545015}, {"username": "leahmariebrooks", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/anonymousUser.jpg", "id": 1146978}, {"username": "cassiesweeney", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1137873_75sq_1293162628.jpg", "id": 1137873}, {"username": "parallaxchico", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1139928_75sq_1293175329.jpg", "id": 1139928}, {"username": "om", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_2637_75sq_1286977009.jpg", "id": 2637}]}
View
1  spec/fixtures/media_comment.json
@@ -0,0 +1 @@
+{"meta": {"code": 200}, "data": {"created_time": "1296772367", "text": "hi there", "from": {"username": "shayne", "first_name": "Shayne", "last_name": "Sweeney", "type": "user", "id": "20"}, "id": "1862278"}}
View
1  spec/fixtures/media_comments.json
@@ -0,0 +1 @@
+{"meta": {"code": 200}, "data": [{"created_time": "1281045379", "text": "Vet visit", "from": {"username": "doug", "first_name": "Doug", "last_name": "Systrom", "type": "user", "id": "17"}, "id": "924"}, {"created_time": "1281046691", "text": "Oh noes!", "from": {"username": "kevin", "first_name": "Kevin", "last_name": "Systrom", "type": "user", "id": "3"}, "id": "928"}, {"created_time": "1281048012", "text": "I love the fact that even though you can't see Barrett's face, you know he's furklempting by the ears.", "from": {"username": "diane", "first_name": "Diane", "last_name": "Systrom", "type": "user", "id": "37"}, "id": "934"}]}
View
1  spec/fixtures/media_liked.json
@@ -0,0 +1 @@
+{"meta": {"code": 200}, "data": null}
View
0  spec/fixtures/media_likers.json → spec/fixtures/media_likes.json
File renamed without changes
View
57 spec/instagram/client/comments_spec.rb
@@ -0,0 +1,57 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe Instagram::Client do
+ Instagram::Configuration::VALID_FORMATS.each do |format|
+ context ".new(:format => '#{format}')" do
+
+ before do
+ @client = Instagram::Client.new(:format => format, :client_id => 'CID', :access_token => 'AT')
+ end
+
+ describe ".media_comments" do
+
+ before do
+ stub_get("media/777/comments.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ to_return(:body => fixture("media_comments.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
+ end
+
+ it "should get the correct resource" do
+ @client.media_comments(777)
+ a_get("media/777/comments.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ should have_been_made
+ end
+
+ it "should return an array of user search results" do
+ comments = @client.media_comments(777)
+ comments.should be_a Array
+ comments.first.text.should == "Vet visit"
+ end
+ end
+
+ describe ".create_media_comment" do
+
+ before do
+ stub_post("media/777/comments.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ with(:body => {:text => "hi there"}).
+ to_return(:body => fixture("media_comment.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
+ end
+
+ it "should get the correct resource" do
+ @client.create_media_comment(777, "hi there")
+ a_post("media/777/comments.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ with(:body => {:text => "hi there"}).
+ should have_been_made
+ end
+
+ it "should return the new comment when successful" do
+ comment = @client.create_media_comment(777, "hi there")
+ comment.text.should == "hi there"
+ end
+ end
+ end
+ end
+end
View
55 spec/instagram/client/likes_spec.rb
@@ -0,0 +1,55 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe Instagram::Client do
+ Instagram::Configuration::VALID_FORMATS.each do |format|
+ context ".new(:format => '#{format}')" do
+
+ before do
+ @client = Instagram::Client.new(:format => format, :client_id => 'CID', :access_token => 'AT')
+ end
+
+ describe ".media_likes" do
+
+ before do
+ stub_get("media/777/likes.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ to_return(:body => fixture("media_likes.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
+ end
+
+ it "should get the correct resource" do
+ @client.media_likes(777)
+ a_get("media/777/likes.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ should have_been_made
+ end
+
+ it "should return an array of user search results" do
+ comments = @client.media_likes(777)
+ comments.should be_a Array
+ comments.first.username.should == "chris"
+ end
+ end
+
+ describe ".like_media" do
+
+ before do
+ stub_post("media/777/likes.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ to_return(:body => fixture("media_liked.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
+ end
+
+ it "should get the correct resource" do
+ @client.like_media(777)
+ a_post("media/777/likes.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ should have_been_made
+ end
+
+ it "should return nil data when successful" do
+ data = @client.like_media(777)
+ data.should == nil
+ end
+ end
+ end
+ end
+end
View
23 spec/instagram/client/media_spec.rb
@@ -27,28 +27,7 @@
media.user.username.should == "mikeyk"
end
end
-
- describe ".media_item_likers" do
-
- before do
- stub_get("media/18600493/likers.#{format}").
- with(:query => {:access_token => @client.access_token}).
- to_return(:body => fixture("media_likers.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
- end
-
- it "should get the correct resource" do
- @client.media_item_likers(18600493)
- a_get("media/18600493/likers.#{format}").
- with(:query => {:access_token => @client.access_token}).
- should have_been_made
- end
-
- it "should return extended information of a given media item" do
- likers = @client.media_item_likers(18600493)
- likers.first.username.should == "chris"
- end
- end
-
+
describe ".media_popular" do
before do
View
19 spec/instagram/client/users_spec.rb
@@ -69,8 +69,7 @@
it "should return an array of user search results" do
users = @client.user_search("Shayne Sweeney")
users.should be_a Array
- users.first.first_name.should == "Shayne"
- users.first.last_name.should == "Sweeney"
+ users.first.username.should == "shayne"
end
end
@@ -79,14 +78,14 @@
context "with user ID passed" do
before do
- stub_get("users/4/follows/users.#{format}").
+ stub_get("users/4/follows.#{format}").
with(:query => {:access_token => @client.access_token}).
to_return(:body => fixture("follows.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.user_follows(4)
- a_get("users/4/follows/users.#{format}").
+ a_get("users/4/follows.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
end
@@ -101,14 +100,14 @@
context "without user ID passed" do
before do
- stub_get("users/self/follows/users.#{format}").
+ stub_get("users/self/follows.#{format}").
with(:query => {:access_token => @client.access_token}).
to_return(:body => fixture("follows.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.user_follows
- a_get("users/self/follows/users.#{format}").
+ a_get("users/self/follows.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
end
@@ -120,14 +119,14 @@
context "with user ID passed" do
before do
- stub_get("users/4/followed-by/users.#{format}").
+ stub_get("users/4/followed-by.#{format}").
with(:query => {:access_token => @client.access_token}).
to_return(:body => fixture("followed_by.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.user_followed_by(4)
- a_get("users/4/followed-by/users.#{format}").
+ a_get("users/4/followed-by.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
end
@@ -142,14 +141,14 @@
context "without user ID passed" do
before do
- stub_get("users/self/followed-by/users.#{format}").
+ stub_get("users/self/followed-by.#{format}").
with(:query => {:access_token => @client.access_token}).
to_return(:body => fixture("followed_by.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.user_followed_by
- a_get("users/self/followed-by/users.#{format}").
+ a_get("users/self/followed-by.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
end
View
28 spec/spec_helper.rb
@@ -1,11 +1,11 @@
require 'simplecov'
SimpleCov.start do
- add_group 'Instagram', 'lib/instagram'
+ add_group 'Instagram', 'lib/Instagram'
add_group 'Faraday Middleware', 'lib/faraday'
add_group 'Specs', 'spec'
end
-require File.expand_path('../../lib/instagram', __FILE__)
+require File.expand_path('../../lib/Instagram', __FILE__)
require 'rspec'
require 'webmock/rspec'
@@ -13,14 +13,38 @@
config.include WebMock::API
end
+def a_delete(path)
+ a_request(:delete, Instagram.endpoint + path)
+end
+
def a_get(path)
a_request(:get, Instagram.endpoint + path)
end
+def a_post(path)
+ a_request(:post, Instagram.endpoint + path)
+end
+
+def a_put(path)
+ a_request(:put, Instagram.endpoint + path)
+end
+
+def stub_delete(path)
+ stub_request(:delete, Instagram.endpoint + path)
+end
+
def stub_get(path)
stub_request(:get, Instagram.endpoint + path)
end
+def stub_post(path)
+ stub_request(:post, Instagram.endpoint + path)
+end
+
+def stub_put(path)
+ stub_request(:put, Instagram.endpoint + path)
+end
+
def fixture_path
File.expand_path("../fixtures", __FILE__)
end
Please sign in to comment.
Something went wrong with that request. Please try again.