instagram 0.10.0 → 0.11.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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzdmODUyMDg3MTBkNjYzM2Q1MjY4YjBkOTUxNTcwN2FmOWMxZGNmMg==
5
+ data.tar.gz: !binary |-
6
+ OWFiZGIxNjU2MThhMjZmMmFiYzU5ZDk4MTQ5MTIyNTc4Nzc4YjE3Ng==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MjAyNjQwNGYxNzEyYThiM2JjM2I0YjhkYjYyYjVhODczMzVkNjgxNzBhZDc5
10
+ ODYxOTYyYjk1YjQ2OGVjOTk2ZmIyNzg0N2ViMzJhYTVjMjQwMzAzNWMyOTZi
11
+ Yzg2ODg5NTZkNzM0NWFkZDAwNDJiMmIyYWRkNmM0ODFmMTYwOTQ=
12
+ data.tar.gz: !binary |-
13
+ NDM1Zjk4MGQ4MjBkMjQ3MmQyZDljN2Q5OTI4ZjQ0YTQ2NTc1NGMxYTc3MTVl
14
+ NjgzYWIzYjUwZDI2ODEwNDY0MzIwYWYwOWU5OTgyMjQ1Y2QwOWFhNTAzN2U2
15
+ NDcwMGYwMTFkYTUzNmEzNDAxM2FiMTFlMWI2MGI3OWQxY2VmZWM=
data/README.md CHANGED
@@ -26,85 +26,88 @@ Add it to the [apps](http://github.com/Instagram/instagram-ruby-gem/wiki/apps) w
26
26
 
27
27
  Sample Application
28
28
  ------------------
29
- require "sinatra"
30
- require "instagram"
31
29
 
32
- enable :sessions
30
+ ```ruby
31
+ require "sinatra"
32
+ require "instagram"
33
33
 
34
- CALLBACK_URL = "http://localhost:4567/oauth/callback"
34
+ enable :sessions
35
35
 
36
- Instagram.configure do |config|
37
- config.client_id = "YOUR_CLIENT_ID"
38
- config.client_secret = "YOUR_CLIENT_SECRET"
39
- end
36
+ CALLBACK_URL = "http://localhost:4567/oauth/callback"
40
37
 
41
- get "/" do
42
- '<a href="/oauth/connect">Connect with Instagram</a>'
43
- end
38
+ Instagram.configure do |config|
39
+ config.client_id = "YOUR_CLIENT_ID"
40
+ config.client_secret = "YOUR_CLIENT_SECRET"
41
+ end
44
42
 
45
- get "/oauth/connect" do
46
- redirect Instagram.authorize_url(:redirect_uri => CALLBACK_URL)
47
- end
43
+ get "/" do
44
+ '<a href="/oauth/connect">Connect with Instagram</a>'
45
+ end
48
46
 
49
- get "/oauth/callback" do
50
- response = Instagram.get_access_token(params[:code], :redirect_uri => CALLBACK_URL)
51
- session[:access_token] = response.access_token
52
- redirect "/feed"
53
- end
47
+ get "/oauth/connect" do
48
+ redirect Instagram.authorize_url(:redirect_uri => CALLBACK_URL)
49
+ end
54
50
 
55
- get "/feed" do
56
- client = Instagram.client(:access_token => session[:access_token])
57
- user = client.user
51
+ get "/oauth/callback" do
52
+ response = Instagram.get_access_token(params[:code], :redirect_uri => CALLBACK_URL)
53
+ session[:access_token] = response.access_token
54
+ redirect "/feed"
55
+ end
58
56
 
59
- html = "<h1>#{user.username}'s recent photos</h1>"
60
- for media_item in client.user_recent_media
61
- html << "<img src='#{media_item.images.thumbnail.url}'>"
62
- end
63
- html
64
- end
57
+ get "/feed" do
58
+ client = Instagram.client(:access_token => session[:access_token])
59
+ user = client.user
65
60
 
61
+ html = "<h1>#{user.username}'s recent photos</h1>"
62
+ for media_item in client.user_recent_media
63
+ html << "<img src='#{media_item.images.thumbnail.url}'>"
64
+ end
65
+ html
66
+ end
67
+ ```
66
68
 
67
69
  API Usage Examples
68
70
  ------------------
69
- require "rubygems"
70
- require "instagram"
71
-
72
- # All methods require authentication (either by client ID or access token).
73
- # To get your Instagram OAuth credentials, register an app at http://instagr.am/oauth/client/register/
74
- Instagram.configure do |config|
75
- config.client_id = YOUR_CLIENT_KEY
76
- config.access_token = YOUR_ACCESS_TOKEN
77
- end
71
+ ```ruby
72
+ require "rubygems"
73
+ require "instagram"
78
74
 
79
- # Get a list of a user's most recent media
80
- puts Instagram.user_recent_media(777)
75
+ # All methods require authentication (either by client ID or access token).
76
+ # To get your Instagram OAuth credentials, register an app at http://instagr.am/oauth/client/register/
77
+ Instagram.configure do |config|
78
+ config.client_id = YOUR_CLIENT_KEY
79
+ config.access_token = YOUR_ACCESS_TOKEN
80
+ end
81
81
 
82
- # Use pagination data from a response to get the next page
83
- page_1 = Instagram.user_recent_media(777)
84
- page_2_max_id = page_1.pagination.next_max_id
85
- page_2 = Instagram.user_recent_media(777, :max_id => page_2_max_id ) unless page_2_max_id.nil?
82
+ # Get a list of a user's most recent media
83
+ puts Instagram.user_recent_media(777)
86
84
 
87
- # Get the currently authenticated user's media feed
88
- puts Instagram.user_media_feed
85
+ # Use pagination data from a response to get the next page
86
+ page_1 = Instagram.user_recent_media(777)
87
+ page_2_max_id = page_1.pagination.next_max_id
88
+ page_2 = Instagram.user_recent_media(777, :max_id => page_2_max_id ) unless page_2_max_id.nil?
89
89
 
90
- # Get a list of recent media at a given location, in this case, the Instagram office
91
- puts Instagram.location_recent_media(514276)
90
+ # Get the currently authenticated user's media feed
91
+ puts Instagram.user_media_feed
92
92
 
93
- # Get a list of media close to a given latitude and longitude
94
- puts Instagram.media_search("37.7808851","-122.3948632")
93
+ # Get a list of recent media at a given location, in this case, the Instagram office
94
+ puts Instagram.location_recent_media(514276)
95
95
 
96
- # Get a list of the overall most popular media items
97
- puts Instagram.media_popular
96
+ # Get a list of media close to a given latitude and longitude
97
+ puts Instagram.media_search("37.7808851","-122.3948632")
98
98
 
99
- # Search for users on instagram, by name or username
100
- puts Instagram.user_search("shayne sweeney")
99
+ # Get a list of the overall most popular media items
100
+ puts Instagram.media_popular
101
101
 
102
- # Search for a location by lat/lng
103
- puts Instagram.location_search("37.7808851","-122.3948632")
102
+ # Search for users on instagram, by name or username
103
+ puts Instagram.user_search("shayne sweeney")
104
104
 
105
- # Search for a location by Fousquare ID (v2)
106
- puts Instagram.location_search("3fd66200f964a520c5f11ee3")
105
+ # Search for a location by lat/lng
106
+ puts Instagram.location_search("37.7808851","-122.3948632")
107
107
 
108
+ # Search for a location by Fousquare ID (v2)
109
+ puts Instagram.location_search("3fd66200f964a520c5f11ee3")
110
+ ```
108
111
 
109
112
 
110
113
 
@@ -129,7 +132,7 @@ Submitting an Issue
129
132
  -------------------
130
133
  We use the [GitHub issue tracker](http://github.com/Instagram/instagram-ruby-gem/issues) to track bugs and
131
134
  features. Before submitting a bug report or feature request, check to make sure it hasn't already
132
- been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
135
+ been submitted. You can indicate support for an existing issue by voting it up. When submitting a
133
136
  bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
134
137
  details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
135
138
  operating system. Ideally, a bug report should include a pull request with failing specs.
@@ -50,7 +50,7 @@ module Instagram
50
50
  # @format :json
51
51
  # @authenticated true
52
52
  #
53
- # In order to remove a comment, you must be either the owner comment or the media item (or both).
53
+ # In order to remove a comment, you must be the owner of the comment, the media item, or both.
54
54
  # @rate_limited true
55
55
  # @see TODO:docs url
56
56
  def delete_media_comment(media_id, comment_id, options={})
@@ -21,7 +21,7 @@ module Instagram
21
21
  # Returns a list of recent media items for a given Instagram tag
22
22
  #
23
23
  # @overload tag_recent_media(tag, options={})
24
- # @param user [String] An Instagram tag name.
24
+ # @param id [String] An Instagram tag name.
25
25
  # @param options [Hash] A customizable set of options.
26
26
  # @option options [Integer] :max_id (nil) Returns results with an ID less than (that is, older than) or equal to the specified ID.
27
27
  # @option options [Integer] :count (nil) Limits the number of results returned per page.
@@ -16,8 +16,9 @@ module Instagram
16
16
  # @rate_limited true
17
17
  # @see TODO:docs url
18
18
  def user(*args)
19
+ options = args.last.is_a?(Hash) ? args.pop : {}
19
20
  id = args.first || 'self'
20
- response = get("users/#{id}")
21
+ response = get("users/#{id}", options)
21
22
  response
22
23
  end
23
24
 
@@ -9,6 +9,7 @@ module Instagram
9
9
  :adapter,
10
10
  :client_id,
11
11
  :client_secret,
12
+ :scope,
12
13
  :access_token,
13
14
  :endpoint,
14
15
  :format,
@@ -39,6 +40,9 @@ module Instagram
39
40
  # By default, don't set a user access token
40
41
  DEFAULT_ACCESS_TOKEN = nil
41
42
 
43
+ # By default, don't set a user scope
44
+ DEFAULT_SCOPE = nil
45
+
42
46
  # The endpoint that will be used to connect if none is set
43
47
  #
44
48
  # @note There is no reason to use any other endpoint at this time
@@ -80,6 +84,7 @@ module Instagram
80
84
  self.adapter = DEFAULT_ADAPTER
81
85
  self.client_id = DEFAULT_CLIENT_ID
82
86
  self.client_secret = DEFAULT_CLIENT_SECRET
87
+ self.scope = DEFAULT_SCOPE
83
88
  self.access_token = DEFAULT_ACCESS_TOKEN
84
89
  self.endpoint = DEFAULT_ENDPOINT
85
90
  self.format = DEFAULT_FORMAT
@@ -10,7 +10,6 @@ module Instagram
10
10
  options = {
11
11
  :headers => {'Accept' => "application/#{format}; charset=utf-8", 'User-Agent' => user_agent},
12
12
  :proxy => proxy,
13
- :ssl => {:verify => false},
14
13
  :url => endpoint,
15
14
  }
16
15
 
@@ -4,6 +4,7 @@ module Instagram
4
4
  # Return URL for OAuth authorization
5
5
  def authorize_url(options={})
6
6
  options[:response_type] ||= "code"
7
+ options[:scope] ||= scope if !scope.nil? && !scope.empty?
7
8
  params = authorization_params.merge(options)
8
9
  connection.build_url("/oauth/authorize/", params).to_s
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Instagram
2
- VERSION = '0.10.0'.freeze unless defined?(::Instagram::VERSION)
2
+ VERSION = '0.11.0'.freeze unless defined?(::Instagram::VERSION)
3
3
  end
@@ -32,6 +32,7 @@ describe Instagram::API do
32
32
  @configuration = {
33
33
  :client_id => 'CID',
34
34
  :client_secret => 'CS',
35
+ :scope => 'comments relationships',
35
36
  :access_token => 'AT',
36
37
  :adapter => :typhoeus,
37
38
  :endpoint => 'http://tumblr.com/',
@@ -93,6 +94,24 @@ describe Instagram::API do
93
94
  url = client.authorize_url(:redirect_uri => redirect_uri)
94
95
  url.should_not include("client_secret")
95
96
  end
97
+
98
+ describe "scope param" do
99
+ it "should include the scope if there is one set" do
100
+ params = { :scope => "comments likes" }
101
+ client = Instagram::Client.new(params)
102
+ redirect_uri = 'http://localhost:4567/oauth/callback'
103
+ url = client.authorize_url(:redirect_uri => redirect_uri)
104
+ url.should include("scope")
105
+ end
106
+
107
+ it "should not include the scope if the scope is blank" do
108
+ params = { :scope => "" }
109
+ client = Instagram::Client.new(params)
110
+ redirect_uri = 'http://localhost:4567/oauth/callback'
111
+ url = client.authorize_url(:redirect_uri => redirect_uri)
112
+ url.should_not include("scope")
113
+ end
114
+ end
96
115
  end
97
116
 
98
117
  describe ".get_access_token" do
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
5
- prerelease:
4
+ version: 0.11.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Shayne Sweeney
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-22 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: webmock
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bluecloth
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: faraday
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -73,7 +65,6 @@ dependencies:
73
65
  type: :runtime
74
66
  prerelease: false
75
67
  version_requirements: !ruby/object:Gem::Requirement
76
- none: false
77
68
  requirements:
78
69
  - - ! '>='
79
70
  - !ruby/object:Gem::Version
@@ -84,7 +75,6 @@ dependencies:
84
75
  - !ruby/object:Gem::Dependency
85
76
  name: faraday_middleware
86
77
  requirement: !ruby/object:Gem::Requirement
87
- none: false
88
78
  requirements:
89
79
  - - ~>
90
80
  - !ruby/object:Gem::Version
@@ -92,7 +82,6 @@ dependencies:
92
82
  type: :runtime
93
83
  prerelease: false
94
84
  version_requirements: !ruby/object:Gem::Requirement
95
- none: false
96
85
  requirements:
97
86
  - - ~>
98
87
  - !ruby/object:Gem::Version
@@ -100,7 +89,6 @@ dependencies:
100
89
  - !ruby/object:Gem::Dependency
101
90
  name: multi_json
102
91
  requirement: !ruby/object:Gem::Requirement
103
- none: false
104
92
  requirements:
105
93
  - - ! '>='
106
94
  - !ruby/object:Gem::Version
@@ -111,7 +99,6 @@ dependencies:
111
99
  type: :runtime
112
100
  prerelease: false
113
101
  version_requirements: !ruby/object:Gem::Requirement
114
- none: false
115
102
  requirements:
116
103
  - - ! '>='
117
104
  - !ruby/object:Gem::Version
@@ -122,7 +109,6 @@ dependencies:
122
109
  - !ruby/object:Gem::Dependency
123
110
  name: hashie
124
111
  requirement: !ruby/object:Gem::Requirement
125
- none: false
126
112
  requirements:
127
113
  - - ! '>='
128
114
  - !ruby/object:Gem::Version
@@ -130,7 +116,6 @@ dependencies:
130
116
  type: :runtime
131
117
  prerelease: false
132
118
  version_requirements: !ruby/object:Gem::Requirement
133
- none: false
134
119
  requirements:
135
120
  - - ! '>='
136
121
  - !ruby/object:Gem::Version
@@ -227,6 +212,7 @@ files:
227
212
  - spec/spec_helper.rb
228
213
  homepage: https://github.com/Instagram/instagram-ruby-gem
229
214
  licenses: []
215
+ metadata: {}
230
216
  post_install_message: ! "********************************************************************************\n\n
231
217
  \ Follow @instagramapi on Twitter for announcements, updates, and news.\n https://twitter.com/instagramapi\n\n
232
218
  \ Join the mailing list!\n https://groups.google.com/group/instagram-ruby-gem\n\n********************************************************************************\n"
@@ -234,25 +220,20 @@ rdoc_options: []
234
220
  require_paths:
235
221
  - lib
236
222
  required_ruby_version: !ruby/object:Gem::Requirement
237
- none: false
238
223
  requirements:
239
224
  - - ! '>='
240
225
  - !ruby/object:Gem::Version
241
226
  version: '0'
242
- segments:
243
- - 0
244
- hash: -4446393396504694126
245
227
  required_rubygems_version: !ruby/object:Gem::Requirement
246
- none: false
247
228
  requirements:
248
229
  - - ! '>='
249
230
  - !ruby/object:Gem::Version
250
231
  version: 1.3.6
251
232
  requirements: []
252
233
  rubyforge_project: instagram
253
- rubygems_version: 1.8.23
234
+ rubygems_version: 2.2.2
254
235
  signing_key:
255
- specification_version: 3
236
+ specification_version: 4
256
237
  summary: Ruby wrapper for the Instagram API
257
238
  test_files:
258
239
  - spec/faraday/response_spec.rb
@@ -308,3 +289,4 @@ test_files:
308
289
  - spec/instagram/client_spec.rb
309
290
  - spec/instagram_spec.rb
310
291
  - spec/spec_helper.rb
292
+ has_rdoc: