instagram 1.0.0 → 1.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.
- checksums.yaml +8 -8
- data/.travis.yml +5 -0
- data/README.md +17 -3
- data/instagram.gemspec +3 -2
- data/lib/faraday/raise_http_exception.rb +4 -0
- data/lib/instagram/client/comments.rb +2 -2
- data/lib/instagram/client/embedding.rb +1 -1
- data/lib/instagram/client/likes.rb +2 -2
- data/lib/instagram/client/tags.rb +1 -1
- data/lib/instagram/client/users.rb +6 -6
- data/lib/instagram/configuration.rb +6 -1
- data/lib/instagram/error.rb +6 -0
- data/lib/instagram/oauth.rb +1 -1
- data/lib/instagram/request.rb +22 -9
- data/lib/instagram/version.rb +1 -1
- data/spec/faraday/response_spec.rb +15 -1
- data/spec/instagram/api_spec.rb +1 -0
- data/spec/instagram/client/likes_spec.rb +1 -1
- data/spec/instagram/request_spec.rb +56 -0
- metadata +62 -12
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGU4OWZjOWU2YjA2Yzg2ZTU5OGMzZTEyMDcxZWM5OTU2NTI5Yzk1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDY2NjdiZjM2YmJiODE1MjllYmMxMTdiZGU2ZmVjMjA3MzM5NDFiNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmMwNDBiNGFlZmMwODg4ZjNlNzQ5NmIwNmYyOGFkMzBlOWJlYjIzYmVjN2Zk
|
10
|
+
YWY2OTY2OTVkOWQyMDBmYjMzMDhmZGMxYWZmMmFiZWE0ZmNmNDJlZmRlNWRl
|
11
|
+
ZDJmMTdkZTc1Y2E3MWU1NWI1NzMwZGJkOWI2ZmRiOWE5MGFhZjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTVjOTBlMjMyYmMyMzRmYTk3MGJjMTdjNDM0YmJlMmMxNzhiNzUwNjc1ZDA3
|
14
|
+
MzJjODgyNmQzZGM2MDExMGQ0ODIyMTQ0ZWIzYzIzMTEwNDkwOTk4MmRhYjg3
|
15
|
+
YTQyYTJmMThkZTk1NTY1ZDY3MjA3OGE1NTI5NTkwZjBkOWFlYzQ=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -39,8 +39,10 @@ enable :sessions
|
|
39
39
|
CALLBACK_URL = "http://localhost:4567/oauth/callback"
|
40
40
|
|
41
41
|
Instagram.configure do |config|
|
42
|
-
config.client_id = "YOUR_CLIENT_ID"
|
43
|
-
config.client_secret = "YOUR_CLIENT_SECRET"
|
42
|
+
config.client_id = "YOUR_CLIENT_ID"
|
43
|
+
config.client_secret = "YOUR_CLIENT_SECRET"
|
44
|
+
# For secured endpoints only
|
45
|
+
#config.client_ips = '<Comma separated list of IPs>'
|
44
46
|
end
|
45
47
|
|
46
48
|
get "/" do
|
@@ -82,11 +84,23 @@ get "/user_recent_media" do
|
|
82
84
|
user = client.user
|
83
85
|
html = "<h1>#{user.username}'s recent media</h1>"
|
84
86
|
for media_item in client.user_recent_media
|
85
|
-
html << "<img src='#{media_item.images.thumbnail.url}'>"
|
87
|
+
html << "<div style='float:left;'><img src='#{media_item.images.thumbnail.url}'><br/> <a href='/media_like/#{media_item.id}'>Like</a> <a href='/media_unlike/#{media_item.id}'>Un-Like</a> <br/>LikesCount=#{media_item.likes[:count]}</div>"
|
86
88
|
end
|
87
89
|
html
|
88
90
|
end
|
89
91
|
|
92
|
+
get '/media_like/:id' do
|
93
|
+
client = Instagram.client(:access_token => session[:access_token])
|
94
|
+
client.like_media("#{params[:id]}")
|
95
|
+
redirect "/user_recent_media"
|
96
|
+
end
|
97
|
+
|
98
|
+
get '/media_unlike/:id' do
|
99
|
+
client = Instagram.client(:access_token => session[:access_token])
|
100
|
+
client.unlike_media("#{params[:id]}")
|
101
|
+
redirect "/user_recent_media"
|
102
|
+
end
|
103
|
+
|
90
104
|
get "/user_media_feed" do
|
91
105
|
client = Instagram.client(:access_token => session[:access_token])
|
92
106
|
user = client.user
|
data/instagram.gemspec
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require File.expand_path('../lib/instagram/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
+
s.add_development_dependency('rake', '~> 0.9.2.2')
|
5
6
|
s.add_development_dependency('rspec', '~> 2.4')
|
6
7
|
s.add_development_dependency('webmock', '~> 1.6')
|
7
8
|
s.add_development_dependency('bluecloth', '~> 2.0.11')
|
@@ -21,9 +22,9 @@ Our developer site documents all the Instagram REST and Search APIs.
|
|
21
22
|
|
22
23
|
Blog
|
23
24
|
----------------------------
|
24
|
-
The Developer Blog features news and important announcements about the Instagram Platform.
|
25
|
+
The Developer Blog features news and important announcements about the Instagram Platform.
|
25
26
|
You will also find tutorials and best practices to help you build great platform integrations.
|
26
|
-
Make sure to subscribe to the RSS feed so you don't miss out on new posts:
|
27
|
+
Make sure to subscribe to the RSS feed so you don't miss out on new posts:
|
27
28
|
(http://developers.instagram.com).
|
28
29
|
|
29
30
|
Community
|
@@ -11,6 +11,8 @@ module FaradayMiddleware
|
|
11
11
|
raise Instagram::BadRequest, error_message_400(response)
|
12
12
|
when 404
|
13
13
|
raise Instagram::NotFound, error_message_400(response)
|
14
|
+
when 429
|
15
|
+
raise Instagram::TooManyRequests, error_message_400(response)
|
14
16
|
when 500
|
15
17
|
raise Instagram::InternalServerError, error_message_500(response, "Something is technically wrong.")
|
16
18
|
when 502
|
@@ -45,6 +47,8 @@ module FaradayMiddleware
|
|
45
47
|
nil
|
46
48
|
elsif body['meta'] and body['meta']['error_message'] and not body['meta']['error_message'].empty?
|
47
49
|
": #{body['meta']['error_message']}"
|
50
|
+
elsif body['error_message'] and not body['error_message'].empty?
|
51
|
+
": #{body['error_type']}: #{body['error_message']}"
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
@@ -35,7 +35,7 @@ module Instagram
|
|
35
35
|
# @rate_limited true
|
36
36
|
# @see http://instagram.com/developer/endpoints/comments/#post_media_comments
|
37
37
|
def create_media_comment(id, text, options={})
|
38
|
-
response = post("media/#{id}/comments", options.merge(:text => text))
|
38
|
+
response = post("media/#{id}/comments", options.merge(:text => text), signature=true)
|
39
39
|
response
|
40
40
|
end
|
41
41
|
|
@@ -54,7 +54,7 @@ module Instagram
|
|
54
54
|
# @rate_limited true
|
55
55
|
# @see http://instagram.com/developer/endpoints/comments/#delete_media_comments
|
56
56
|
def delete_media_comment(media_id, comment_id, options={})
|
57
|
-
response = delete("media/#{media_id}/comments/#{comment_id}", options)
|
57
|
+
response = delete("media/#{media_id}/comments/#{comment_id}", options, signature=true)
|
58
58
|
response
|
59
59
|
end
|
60
60
|
end
|
@@ -34,7 +34,7 @@ module Instagram
|
|
34
34
|
# @rate_limited true
|
35
35
|
# @see http://instagram.com/developer/endpoints/likes/#post_likes
|
36
36
|
def like_media(id, options={})
|
37
|
-
response = post("media/#{id}/likes", options)
|
37
|
+
response = post("media/#{id}/likes", options, signature=true)
|
38
38
|
response
|
39
39
|
end
|
40
40
|
|
@@ -50,7 +50,7 @@ module Instagram
|
|
50
50
|
# @rate_limited true
|
51
51
|
# @see http://instagram.com/developer/endpoints/likes/#delete_likes
|
52
52
|
def unlike_media(id, options={})
|
53
|
-
response = delete("media/#{id}/likes", options)
|
53
|
+
response = delete("media/#{id}/likes", options, signature=true)
|
54
54
|
response
|
55
55
|
end
|
56
56
|
end
|
@@ -34,7 +34,7 @@ module Instagram
|
|
34
34
|
# @rate_limited true
|
35
35
|
def tag_recent_media(id, *args)
|
36
36
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
37
|
-
response = get("tags/#{id}/media/recent", options, false, false)
|
37
|
+
response = get("tags/#{id}/media/recent", options, false, false, false)
|
38
38
|
response
|
39
39
|
end
|
40
40
|
|
@@ -213,7 +213,7 @@ module Instagram
|
|
213
213
|
# @rate_limited true
|
214
214
|
def follow_user(id, options={})
|
215
215
|
options["action"] = "follow"
|
216
|
-
response = post("users/#{id}/relationship", options)
|
216
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
217
217
|
response
|
218
218
|
end
|
219
219
|
|
@@ -231,7 +231,7 @@ module Instagram
|
|
231
231
|
# @rate_limited true
|
232
232
|
def unfollow_user(id, options={})
|
233
233
|
options["action"] = "unfollow"
|
234
|
-
response = post("users/#{id}/relationship", options)
|
234
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
235
235
|
response
|
236
236
|
end
|
237
237
|
|
@@ -249,7 +249,7 @@ module Instagram
|
|
249
249
|
# @rate_limited true
|
250
250
|
def block_user(id, options={})
|
251
251
|
options["action"] = "block"
|
252
|
-
response = post("users/#{id}/relationship", options)
|
252
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
253
253
|
response
|
254
254
|
end
|
255
255
|
|
@@ -267,7 +267,7 @@ module Instagram
|
|
267
267
|
# @rate_limited true
|
268
268
|
def unblock_user(id, options={})
|
269
269
|
options["action"] = "unblock"
|
270
|
-
response = post("users/#{id}/relationship", options)
|
270
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
271
271
|
response
|
272
272
|
end
|
273
273
|
|
@@ -285,7 +285,7 @@ module Instagram
|
|
285
285
|
# @rate_limited true
|
286
286
|
def approve_user(id, options={})
|
287
287
|
options["action"] = "approve"
|
288
|
-
response = post("users/#{id}/relationship", options)
|
288
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
289
289
|
response
|
290
290
|
end
|
291
291
|
|
@@ -303,7 +303,7 @@ module Instagram
|
|
303
303
|
# @rate_limited true
|
304
304
|
def deny_user(id, options={})
|
305
305
|
options["action"] = "deny"
|
306
|
-
response = post("users/#{id}/relationship", options)
|
306
|
+
response = post("users/#{id}/relationship", options, signature=true)
|
307
307
|
response
|
308
308
|
end
|
309
309
|
end
|
@@ -10,6 +10,7 @@ module Instagram
|
|
10
10
|
:adapter,
|
11
11
|
:client_id,
|
12
12
|
:client_secret,
|
13
|
+
:client_ips,
|
13
14
|
:connection_options,
|
14
15
|
:scope,
|
15
16
|
:redirect_uri,
|
@@ -34,6 +35,9 @@ module Instagram
|
|
34
35
|
# By default, don't set an application secret
|
35
36
|
DEFAULT_CLIENT_SECRET = nil
|
36
37
|
|
38
|
+
# By default, don't set application IPs
|
39
|
+
DEFAULT_CLIENT_IPS = nil
|
40
|
+
|
37
41
|
# By default, don't set any connection options
|
38
42
|
DEFAULT_CONNECTION_OPTIONS = {}
|
39
43
|
|
@@ -94,6 +98,7 @@ module Instagram
|
|
94
98
|
self.adapter = DEFAULT_ADAPTER
|
95
99
|
self.client_id = DEFAULT_CLIENT_ID
|
96
100
|
self.client_secret = DEFAULT_CLIENT_SECRET
|
101
|
+
self.client_ips = DEFAULT_CLIENT_IPS
|
97
102
|
self.connection_options = DEFAULT_CONNECTION_OPTIONS
|
98
103
|
self.scope = DEFAULT_SCOPE
|
99
104
|
self.redirect_uri = DEFAULT_REDIRECT_URI
|
@@ -101,7 +106,7 @@ module Instagram
|
|
101
106
|
self.format = DEFAULT_FORMAT
|
102
107
|
self.proxy = DEFAULT_PROXY
|
103
108
|
self.user_agent = DEFAULT_USER_AGENT
|
104
|
-
self.no_response_wrapper= DEFAULT_NO_RESPONSE_WRAPPER
|
109
|
+
self.no_response_wrapper= DEFAULT_NO_RESPONSE_WRAPPER
|
105
110
|
end
|
106
111
|
end
|
107
112
|
end
|
data/lib/instagram/error.rb
CHANGED
@@ -8,6 +8,9 @@ module Instagram
|
|
8
8
|
# Raised when Instagram returns the HTTP status code 404
|
9
9
|
class NotFound < Error; end
|
10
10
|
|
11
|
+
# Raised when Instagram returns the HTTP status code 429
|
12
|
+
class TooManyRequests < Error; end
|
13
|
+
|
11
14
|
# Raised when Instagram returns the HTTP status code 500
|
12
15
|
class InternalServerError < Error; end
|
13
16
|
|
@@ -22,4 +25,7 @@ module Instagram
|
|
22
25
|
|
23
26
|
# Raised when a subscription payload hash is invalid
|
24
27
|
class InvalidSignature < Error; end
|
28
|
+
|
29
|
+
# Raised when Instagram returns the HTTP status code 429
|
30
|
+
class RateLimitExceeded < Error; end
|
25
31
|
end
|
data/lib/instagram/oauth.rb
CHANGED
@@ -15,7 +15,7 @@ module Instagram
|
|
15
15
|
options[:grant_type] ||= "authorization_code"
|
16
16
|
options[:redirect_uri] ||= self.redirect_uri
|
17
17
|
params = access_token_params.merge(options)
|
18
|
-
post("/oauth/access_token/", params.merge(:code => code), raw=false, unformatted=true, no_response_wrapper=true)
|
18
|
+
post("/oauth/access_token/", params.merge(:code => code), signature=false, raw=false, unformatted=true, no_response_wrapper=true)
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
data/lib/instagram/request.rb
CHANGED
@@ -1,30 +1,33 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
1
4
|
module Instagram
|
2
5
|
# Defines HTTP request methods
|
3
6
|
module Request
|
4
7
|
# Perform an HTTP GET request
|
5
|
-
def get(path, options={}, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
6
|
-
request(:get, path, options, raw, unformatted, no_response_wrapper)
|
8
|
+
def get(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
9
|
+
request(:get, path, options, signature, raw, unformatted, no_response_wrapper)
|
7
10
|
end
|
8
11
|
|
9
12
|
# Perform an HTTP POST request
|
10
|
-
def post(path, options={}, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
11
|
-
request(:post, path, options, raw, unformatted, no_response_wrapper)
|
13
|
+
def post(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
14
|
+
request(:post, path, options, signature, raw, unformatted, no_response_wrapper)
|
12
15
|
end
|
13
16
|
|
14
17
|
# Perform an HTTP PUT request
|
15
|
-
def put(path, options={}, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
16
|
-
request(:put, path, options, raw, unformatted, no_response_wrapper)
|
18
|
+
def put(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
19
|
+
request(:put, path, options, signature, raw, unformatted, no_response_wrapper)
|
17
20
|
end
|
18
21
|
|
19
22
|
# Perform an HTTP DELETE request
|
20
|
-
def delete(path, options={}, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
21
|
-
request(:delete, path, options, raw, unformatted, no_response_wrapper)
|
23
|
+
def delete(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper)
|
24
|
+
request(:delete, path, options, signature, raw, unformatted, no_response_wrapper)
|
22
25
|
end
|
23
26
|
|
24
27
|
private
|
25
28
|
|
26
29
|
# Perform an HTTP request
|
27
|
-
def request(method, path, options, raw=false, unformatted=false, no_response_wrapper=false)
|
30
|
+
def request(method, path, options, signature=false, raw=false, unformatted=false, no_response_wrapper=false)
|
28
31
|
response = connection(raw).send(method) do |request|
|
29
32
|
path = formatted_path(path) unless unformatted
|
30
33
|
case method
|
@@ -34,6 +37,9 @@ module Instagram
|
|
34
37
|
request.path = path
|
35
38
|
request.body = options unless options.empty?
|
36
39
|
end
|
40
|
+
if signature && client_ips != nil
|
41
|
+
request.headers["X-Insta-Forwarded-For"] = get_insta_fowarded_for(client_ips, client_secret)
|
42
|
+
end
|
37
43
|
end
|
38
44
|
return response if raw
|
39
45
|
return response.body if no_response_wrapper
|
@@ -43,5 +49,12 @@ module Instagram
|
|
43
49
|
def formatted_path(path)
|
44
50
|
[path, format].compact.join('.')
|
45
51
|
end
|
52
|
+
|
53
|
+
def get_insta_fowarded_for(ips, secret)
|
54
|
+
digest = OpenSSL::Digest::Digest.new('sha256')
|
55
|
+
signature = OpenSSL::HMAC.hexdigest(digest, secret, ips)
|
56
|
+
return [ips, signature].join('|')
|
57
|
+
end
|
58
|
+
|
46
59
|
end
|
47
60
|
end
|
data/lib/instagram/version.rb
CHANGED
@@ -8,6 +8,7 @@ describe Faraday::Response do
|
|
8
8
|
{
|
9
9
|
400 => Instagram::BadRequest,
|
10
10
|
404 => Instagram::NotFound,
|
11
|
+
429 => Instagram::TooManyRequests,
|
11
12
|
500 => Instagram::InternalServerError,
|
12
13
|
503 => Instagram::ServiceUnavailable
|
13
14
|
}.each do |status, exception|
|
@@ -36,7 +37,20 @@ describe Faraday::Response do
|
|
36
37
|
it "should return the body error message" do
|
37
38
|
expect do
|
38
39
|
@client.user_media_feed()
|
39
|
-
end.to raise_error(Instagram::BadRequest, /Bad words are bad
|
40
|
+
end.to raise_error(Instagram::BadRequest, /Bad words are bad\./)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when a 400 is raised with no meta but an error_message" do
|
45
|
+
before do
|
46
|
+
stub_get('users/self/feed.json').
|
47
|
+
to_return(:body => '{"error_type": "OAuthException", "error_message": "No matching code found."}', :status => 400)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return the body error type and message" do
|
51
|
+
expect do
|
52
|
+
@client.user_media_feed()
|
53
|
+
end.to raise_error(Instagram::BadRequest, /OAuthException: No matching code found\./)
|
40
54
|
end
|
41
55
|
end
|
42
56
|
|
data/spec/instagram/api_spec.rb
CHANGED
@@ -34,6 +34,7 @@ describe Instagram::API do
|
|
34
34
|
:adapter => :typhoeus,
|
35
35
|
:client_id => 'CID',
|
36
36
|
:client_secret => 'CS',
|
37
|
+
:client_ips => '1.2.3.4',
|
37
38
|
:connection_options => { :ssl => { :verify => true } },
|
38
39
|
:redirect_uri => 'http://http://localhost:4567/oauth/callback',
|
39
40
|
:endpoint => 'http://tumblr.com/',
|
@@ -5,7 +5,7 @@ describe Instagram::Client do
|
|
5
5
|
context ".new(:format => '#{format}')" do
|
6
6
|
|
7
7
|
before do
|
8
|
-
@client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
|
8
|
+
@client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :client_ips => '1.2.3.4', :access_token => 'AT')
|
9
9
|
end
|
10
10
|
|
11
11
|
describe ".media_likes" do
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe Instagram::Request do
|
4
|
+
describe "#post" do
|
5
|
+
before do
|
6
|
+
@ips = "1.2.3.4"
|
7
|
+
@secret = "CS"
|
8
|
+
digest = OpenSSL::Digest::Digest.new('sha256')
|
9
|
+
signature = OpenSSL::HMAC.hexdigest(digest, @secret, @ips)
|
10
|
+
@signed_header = [@ips, signature].join('|')
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with signature=true" do
|
14
|
+
it "should set X-Insta-Forwarded-For header" do
|
15
|
+
client = Instagram::Client.new(:client_id => "CID", :client_secret => @secret, :client_ips => @ips, :access_token => "AT")
|
16
|
+
url = client.send(:connection).build_url("/media/123/likes.json").to_s
|
17
|
+
stub_request(:post, url).
|
18
|
+
with(:body => {"access_token"=>"AT"}).
|
19
|
+
to_return(:status => 200, :body => "", :headers => {})
|
20
|
+
|
21
|
+
client.post("/media/123/likes", {}, signature=true)
|
22
|
+
a_request(:post, url).
|
23
|
+
with(:headers => {'X-Insta-Forwarded-For'=> @signed_header}).
|
24
|
+
should have_been_made
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should not set X-Insta-Fowarded-For header if client_ips is not provided" do
|
28
|
+
client = Instagram::Client.new(:client_id => "CID", :client_secret => @secret, :access_token => "AT")
|
29
|
+
url = client.send(:connection).build_url("/media/123/likes.json").to_s
|
30
|
+
stub_request(:post, url).
|
31
|
+
with(:body => {"access_token"=>"AT"}).
|
32
|
+
to_return(:status => 200, :body => "", :headers => {})
|
33
|
+
|
34
|
+
client.post("/media/123/likes", {}, signature=true)
|
35
|
+
a_request(:post, url).
|
36
|
+
with(:headers => {'X-Insta-Forwarded-For'=> @signed_header}).
|
37
|
+
should_not have_been_made
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with signature=false" do
|
42
|
+
it "should set X-Insta-Forwarded-For header" do
|
43
|
+
client = Instagram::Client.new(:client_id => "CID", :client_secret => @secret, :client_ips => @ips, :access_token => "AT")
|
44
|
+
url = client.send(:connection).build_url("/media/123/likes.json").to_s
|
45
|
+
stub_request(:post, url).
|
46
|
+
with(:body => {"access_token"=>"AT"}).
|
47
|
+
to_return(:status => 200, :body => "", :headers => {})
|
48
|
+
|
49
|
+
client.post("/media/123/likes", {}, signature=false)
|
50
|
+
a_request(:post, url).
|
51
|
+
with(:headers => {'X-Insta-Forwarded-For'=> @signed_header}).
|
52
|
+
should_not have_been_made
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instagram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shayne Sweeney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.2.2
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.2.2
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +149,7 @@ extra_rdoc_files: []
|
|
135
149
|
files:
|
136
150
|
- .gitignore
|
137
151
|
- .rspec
|
152
|
+
- .travis.yml
|
138
153
|
- .yardopts
|
139
154
|
- Gemfile
|
140
155
|
- LICENSE.md
|
@@ -215,21 +230,55 @@ files:
|
|
215
230
|
- spec/instagram/client/tags_spec.rb
|
216
231
|
- spec/instagram/client/users_spec.rb
|
217
232
|
- spec/instagram/client_spec.rb
|
233
|
+
- spec/instagram/request_spec.rb
|
218
234
|
- spec/instagram_spec.rb
|
219
235
|
- spec/spec_helper.rb
|
220
236
|
homepage: https://github.com/Instagram/instagram-ruby-gem
|
221
237
|
licenses: []
|
222
238
|
metadata: {}
|
223
|
-
post_install_message: !
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
239
|
+
post_install_message: ! '********************************************************************************
|
240
|
+
|
241
|
+
|
242
|
+
Instagram REST and Search APIs
|
243
|
+
|
244
|
+
------------------------------
|
245
|
+
|
246
|
+
Our developer site documents all the Instagram REST and Search APIs.
|
247
|
+
|
248
|
+
(http://instagram.com/developer)
|
249
|
+
|
250
|
+
|
251
|
+
Blog
|
252
|
+
|
253
|
+
----------------------------
|
254
|
+
|
255
|
+
The Developer Blog features news and important announcements about the Instagram
|
256
|
+
Platform.
|
257
|
+
|
258
|
+
You will also find tutorials and best practices to help you build great platform
|
259
|
+
integrations.
|
260
|
+
|
261
|
+
Make sure to subscribe to the RSS feed so you don''t miss out on new posts:
|
262
|
+
|
263
|
+
(http://developers.instagram.com).
|
264
|
+
|
265
|
+
|
266
|
+
Community
|
267
|
+
|
268
|
+
----------------------
|
269
|
+
|
270
|
+
The Stack Overflow community is a great place to ask API related questions or if
|
271
|
+
you need help with your code.
|
272
|
+
|
273
|
+
Make sure to tag your questions with the Instagram tag to get fast answers from
|
274
|
+
other fellow developers and members of the Instagram team.
|
275
|
+
|
276
|
+
(http://stackoverflow.com/questions/tagged/instagram/)
|
277
|
+
|
278
|
+
|
279
|
+
********************************************************************************
|
280
|
+
|
281
|
+
'
|
233
282
|
rdoc_options: []
|
234
283
|
require_paths:
|
235
284
|
- lib
|
@@ -301,6 +350,7 @@ test_files:
|
|
301
350
|
- spec/instagram/client/tags_spec.rb
|
302
351
|
- spec/instagram/client/users_spec.rb
|
303
352
|
- spec/instagram/client_spec.rb
|
353
|
+
- spec/instagram/request_spec.rb
|
304
354
|
- spec/instagram_spec.rb
|
305
355
|
- spec/spec_helper.rb
|
306
356
|
has_rdoc:
|