localist-instagvram 0.6.2

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.
Files changed (71) hide show
  1. data/.gitignore +12 -0
  2. data/.rspec +3 -0
  3. data/.yardopts +9 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE.md +20 -0
  6. data/README.md +144 -0
  7. data/Rakefile +22 -0
  8. data/instagram.gemspec +42 -0
  9. data/lib/faraday/oauth2.rb +36 -0
  10. data/lib/faraday/raise_http_4xx.rb +37 -0
  11. data/lib/faraday/raise_http_5xx.rb +29 -0
  12. data/lib/instagram.rb +26 -0
  13. data/lib/instagram/api.rb +23 -0
  14. data/lib/instagram/client.rb +19 -0
  15. data/lib/instagram/client/comments.rb +62 -0
  16. data/lib/instagram/client/likes.rb +58 -0
  17. data/lib/instagram/client/locations.rb +59 -0
  18. data/lib/instagram/client/media.rb +63 -0
  19. data/lib/instagram/client/real_time.rb +8 -0
  20. data/lib/instagram/client/subscriptions.rb +156 -0
  21. data/lib/instagram/client/tags.rb +59 -0
  22. data/lib/instagram/client/users.rb +165 -0
  23. data/lib/instagram/client/utils.rb +15 -0
  24. data/lib/instagram/configuration.rb +90 -0
  25. data/lib/instagram/connection.rb +31 -0
  26. data/lib/instagram/error.rb +19 -0
  27. data/lib/instagram/oauth.rb +27 -0
  28. data/lib/instagram/request.rb +45 -0
  29. data/lib/instagram/version.rb +3 -0
  30. data/spec/faraday/response_spec.rb +28 -0
  31. data/spec/fixtures/access_token.json +9 -0
  32. data/spec/fixtures/followed_by.json +1 -0
  33. data/spec/fixtures/follows.json +1 -0
  34. data/spec/fixtures/location.json +1 -0
  35. data/spec/fixtures/location_recent_media.json +1 -0
  36. data/spec/fixtures/location_search.json +1 -0
  37. data/spec/fixtures/media.json +1 -0
  38. data/spec/fixtures/media_comment.json +1 -0
  39. data/spec/fixtures/media_comment_deleted.json +1 -0
  40. data/spec/fixtures/media_comments.json +1 -0
  41. data/spec/fixtures/media_liked.json +1 -0
  42. data/spec/fixtures/media_likes.json +1 -0
  43. data/spec/fixtures/media_popular.json +1 -0
  44. data/spec/fixtures/media_search.json +1 -0
  45. data/spec/fixtures/media_unliked.json +1 -0
  46. data/spec/fixtures/mikeyk.json +1 -0
  47. data/spec/fixtures/recent_media.json +1 -0
  48. data/spec/fixtures/requested_by.json +12 -0
  49. data/spec/fixtures/shayne.json +1 -0
  50. data/spec/fixtures/subscription.json +12 -0
  51. data/spec/fixtures/subscription_deleted.json +1 -0
  52. data/spec/fixtures/subscription_payload.json +14 -0
  53. data/spec/fixtures/subscriptions.json +22 -0
  54. data/spec/fixtures/tag.json +1 -0
  55. data/spec/fixtures/tag_recent_media.json +1 -0
  56. data/spec/fixtures/tag_search.json +1 -0
  57. data/spec/fixtures/user_media_feed.json +1 -0
  58. data/spec/fixtures/user_search.json +1 -0
  59. data/spec/instagram/api_spec.rb +110 -0
  60. data/spec/instagram/client/comments_spec.rb +71 -0
  61. data/spec/instagram/client/likes_spec.rb +66 -0
  62. data/spec/instagram/client/locations_spec.rb +78 -0
  63. data/spec/instagram/client/media_spec.rb +78 -0
  64. data/spec/instagram/client/real_time_spec.rb +13 -0
  65. data/spec/instagram/client/subscriptions_spec.rb +148 -0
  66. data/spec/instagram/client/tags_spec.rb +78 -0
  67. data/spec/instagram/client/users_spec.rb +237 -0
  68. data/spec/instagram/client_spec.rb +23 -0
  69. data/spec/instagram_spec.rb +97 -0
  70. data/spec/spec_helper.rb +54 -0
  71. metadata +307 -0
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe Instagram::Client do
4
+ it "should connect using the endpoint configuration" do
5
+ client = Instagram::Client.new
6
+ endpoint = URI.parse(client.endpoint)
7
+ connection = client.send(:connection).build_url(nil).to_s
8
+ connection.should == endpoint.to_s
9
+ end
10
+
11
+ it "should not cache the user account across clients" do
12
+ stub_get("users/self.json").
13
+ with(:query => {:access_token => "at1"}).
14
+ to_return(:body => fixture("shayne.json"), :headers => {:content_type => "application/json; charset=utf-8"})
15
+ client1 = Instagram::Client.new(:access_token => "at1")
16
+ client1.send(:get_username).should == "shayne"
17
+ stub_get("users/self.json").
18
+ with(:query => {:access_token => "at2"}).
19
+ to_return(:body => fixture("mikeyk.json"), :headers => {:content_type => "application/json; charset=utf-8"})
20
+ client2 = Instagram::Client.new(:access_token => "at2")
21
+ client2.send(:get_username).should == "mikeyk"
22
+ end
23
+ end
@@ -0,0 +1,97 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe Instagram do
4
+ after do
5
+ Instagram.reset
6
+ end
7
+
8
+ context "when delegating to a client" do
9
+
10
+ before do
11
+ stub_get("users/self/feed.json").
12
+ to_return(:body => fixture("user_media_feed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
13
+ end
14
+
15
+ it "should get the correct resource" do
16
+ Instagram.user_media_feed()
17
+ a_get("users/self/feed.json").
18
+ should have_been_made
19
+ end
20
+
21
+ it "should return the same results as a client" do
22
+ Instagram.user_media_feed().should == Instagram::Client.new.user_media_feed()
23
+ end
24
+
25
+ end
26
+
27
+ describe ".client" do
28
+ it "should be a Instagram::Client" do
29
+ Instagram.client.should be_a Instagram::Client
30
+ end
31
+ end
32
+
33
+ describe ".adapter" do
34
+ it "should return the default adapter" do
35
+ Instagram.adapter.should == Instagram::Configuration::DEFAULT_ADAPTER
36
+ end
37
+ end
38
+
39
+ describe ".adapter=" do
40
+ it "should set the adapter" do
41
+ Instagram.adapter = :typhoeus
42
+ Instagram.adapter.should == :typhoeus
43
+ end
44
+ end
45
+
46
+ describe ".endpoint" do
47
+ it "should return the default endpoint" do
48
+ Instagram.endpoint.should == Instagram::Configuration::DEFAULT_ENDPOINT
49
+ end
50
+ end
51
+
52
+ describe ".endpoint=" do
53
+ it "should set the endpoint" do
54
+ Instagram.endpoint = 'http://tumblr.com'
55
+ Instagram.endpoint.should == 'http://tumblr.com'
56
+ end
57
+ end
58
+
59
+ describe ".format" do
60
+ it "should return the default format" do
61
+ Instagram.format.should == Instagram::Configuration::DEFAULT_FORMAT
62
+ end
63
+ end
64
+
65
+ describe ".format=" do
66
+ it "should set the format" do
67
+ Instagram.format = 'xml'
68
+ Instagram.format.should == 'xml'
69
+ end
70
+ end
71
+
72
+ describe ".user_agent" do
73
+ it "should return the default user agent" do
74
+ Instagram.user_agent.should == Instagram::Configuration::DEFAULT_USER_AGENT
75
+ end
76
+ end
77
+
78
+ describe ".user_agent=" do
79
+ it "should set the user_agent" do
80
+ Instagram.user_agent = 'Custom User Agent'
81
+ Instagram.user_agent.should == 'Custom User Agent'
82
+ end
83
+ end
84
+
85
+ describe ".configure" do
86
+
87
+ Instagram::Configuration::VALID_OPTIONS_KEYS.each do |key|
88
+
89
+ it "should set the #{key}" do
90
+ Instagram.configure do |config|
91
+ config.send("#{key}=", key)
92
+ Instagram.send(key).should == key
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,54 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group 'Instagram', 'lib/instagram'
4
+ add_group 'Faraday Middleware', 'lib/faraday'
5
+ add_group 'Specs', 'spec'
6
+ end
7
+
8
+ require File.expand_path('../../lib/instagram', __FILE__)
9
+
10
+ require 'rspec'
11
+ require 'webmock/rspec'
12
+ RSpec.configure do |config|
13
+ config.include WebMock::API
14
+ end
15
+
16
+ def a_delete(path)
17
+ a_request(:delete, Instagram.endpoint + path)
18
+ end
19
+
20
+ def a_get(path)
21
+ a_request(:get, Instagram.endpoint + path)
22
+ end
23
+
24
+ def a_post(path)
25
+ a_request(:post, Instagram.endpoint + path)
26
+ end
27
+
28
+ def a_put(path)
29
+ a_request(:put, Instagram.endpoint + path)
30
+ end
31
+
32
+ def stub_delete(path)
33
+ stub_request(:delete, Instagram.endpoint + path)
34
+ end
35
+
36
+ def stub_get(path)
37
+ stub_request(:get, Instagram.endpoint + path)
38
+ end
39
+
40
+ def stub_post(path)
41
+ stub_request(:post, Instagram.endpoint + path)
42
+ end
43
+
44
+ def stub_put(path)
45
+ stub_request(:put, Instagram.endpoint + path)
46
+ end
47
+
48
+ def fixture_path
49
+ File.expand_path("../fixtures", __FILE__)
50
+ end
51
+
52
+ def fixture(file)
53
+ File.new(fixture_path + '/' + file)
54
+ end
metadata ADDED
@@ -0,0 +1,307 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: localist-instagvram
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.6.2
6
+ platform: ruby
7
+ authors:
8
+ - Shayne Sweeney
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-03 00:00:00 +12:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bundler
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: "1.0"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: "0.8"
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: "2.4"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: yard
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: "0.6"
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: simplecov
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: "0.3"
69
+ type: :development
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: webmock
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: "1.6"
80
+ type: :development
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: ZenTest
84
+ prerelease: false
85
+ requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: "4.4"
91
+ type: :development
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: faraday
95
+ prerelease: false
96
+ requirement: &id008 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: 0.6.1
102
+ type: :runtime
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: faraday_middleware
106
+ prerelease: false
107
+ requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.3.1
113
+ type: :runtime
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
116
+ name: multi_json
117
+ prerelease: false
118
+ requirement: &id010 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 0.0.5
124
+ type: :runtime
125
+ version_requirements: *id010
126
+ - !ruby/object:Gem::Dependency
127
+ name: hashie
128
+ prerelease: false
129
+ requirement: &id011 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ version: 1.0.0
135
+ type: :runtime
136
+ version_requirements: *id011
137
+ - !ruby/object:Gem::Dependency
138
+ name: ruby-hmac
139
+ prerelease: false
140
+ requirement: &id012 !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 0.4.0
146
+ type: :runtime
147
+ version_requirements: *id012
148
+ description: A Ruby wrapper for the Instagram REST and Search APIs
149
+ email:
150
+ - shayne@instagr.am
151
+ executables: []
152
+
153
+ extensions: []
154
+
155
+ extra_rdoc_files: []
156
+
157
+ files:
158
+ - .gitignore
159
+ - .rspec
160
+ - .yardopts
161
+ - Gemfile
162
+ - LICENSE.md
163
+ - README.md
164
+ - Rakefile
165
+ - instagram.gemspec
166
+ - lib/faraday/oauth2.rb
167
+ - lib/faraday/raise_http_4xx.rb
168
+ - lib/faraday/raise_http_5xx.rb
169
+ - lib/instagram.rb
170
+ - lib/instagram/api.rb
171
+ - lib/instagram/client.rb
172
+ - lib/instagram/client/comments.rb
173
+ - lib/instagram/client/likes.rb
174
+ - lib/instagram/client/locations.rb
175
+ - lib/instagram/client/media.rb
176
+ - lib/instagram/client/real_time.rb
177
+ - lib/instagram/client/subscriptions.rb
178
+ - lib/instagram/client/tags.rb
179
+ - lib/instagram/client/users.rb
180
+ - lib/instagram/client/utils.rb
181
+ - lib/instagram/configuration.rb
182
+ - lib/instagram/connection.rb
183
+ - lib/instagram/error.rb
184
+ - lib/instagram/oauth.rb
185
+ - lib/instagram/request.rb
186
+ - lib/instagram/version.rb
187
+ - spec/faraday/response_spec.rb
188
+ - spec/fixtures/access_token.json
189
+ - spec/fixtures/followed_by.json
190
+ - spec/fixtures/follows.json
191
+ - spec/fixtures/location.json
192
+ - spec/fixtures/location_recent_media.json
193
+ - spec/fixtures/location_search.json
194
+ - spec/fixtures/media.json
195
+ - spec/fixtures/media_comment.json
196
+ - spec/fixtures/media_comment_deleted.json
197
+ - spec/fixtures/media_comments.json
198
+ - spec/fixtures/media_liked.json
199
+ - spec/fixtures/media_likes.json
200
+ - spec/fixtures/media_popular.json
201
+ - spec/fixtures/media_search.json
202
+ - spec/fixtures/media_unliked.json
203
+ - spec/fixtures/mikeyk.json
204
+ - spec/fixtures/recent_media.json
205
+ - spec/fixtures/requested_by.json
206
+ - spec/fixtures/shayne.json
207
+ - spec/fixtures/subscription.json
208
+ - spec/fixtures/subscription_deleted.json
209
+ - spec/fixtures/subscription_payload.json
210
+ - spec/fixtures/subscriptions.json
211
+ - spec/fixtures/tag.json
212
+ - spec/fixtures/tag_recent_media.json
213
+ - spec/fixtures/tag_search.json
214
+ - spec/fixtures/user_media_feed.json
215
+ - spec/fixtures/user_search.json
216
+ - spec/instagram/api_spec.rb
217
+ - spec/instagram/client/comments_spec.rb
218
+ - spec/instagram/client/likes_spec.rb
219
+ - spec/instagram/client/locations_spec.rb
220
+ - spec/instagram/client/media_spec.rb
221
+ - spec/instagram/client/real_time_spec.rb
222
+ - spec/instagram/client/subscriptions_spec.rb
223
+ - spec/instagram/client/tags_spec.rb
224
+ - spec/instagram/client/users_spec.rb
225
+ - spec/instagram/client_spec.rb
226
+ - spec/instagram_spec.rb
227
+ - spec/spec_helper.rb
228
+ has_rdoc: true
229
+ homepage: https://github.com/Instagram/instagramrb
230
+ licenses: []
231
+
232
+ post_install_message: |
233
+ ********************************************************************************
234
+
235
+ Follow @instagram on Twitter for announcements, updates, and news.
236
+ https://twitter.com/instagramapi
237
+
238
+ Join the mailing list!
239
+ https://groups.google.com/group/instagram-ruby-gem
240
+
241
+ ********************************************************************************
242
+
243
+ rdoc_options: []
244
+
245
+ require_paths:
246
+ - lib
247
+ required_ruby_version: !ruby/object:Gem::Requirement
248
+ none: false
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ version: "0"
253
+ required_rubygems_version: !ruby/object:Gem::Requirement
254
+ none: false
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: 1.3.6
259
+ requirements: []
260
+
261
+ rubyforge_project: localist-instagvram
262
+ rubygems_version: 1.6.2
263
+ signing_key:
264
+ specification_version: 3
265
+ summary: Ruby wrapper for the Instagram API
266
+ test_files:
267
+ - spec/faraday/response_spec.rb
268
+ - spec/fixtures/access_token.json
269
+ - spec/fixtures/followed_by.json
270
+ - spec/fixtures/follows.json
271
+ - spec/fixtures/location.json
272
+ - spec/fixtures/location_recent_media.json
273
+ - spec/fixtures/location_search.json
274
+ - spec/fixtures/media.json
275
+ - spec/fixtures/media_comment.json
276
+ - spec/fixtures/media_comment_deleted.json
277
+ - spec/fixtures/media_comments.json
278
+ - spec/fixtures/media_liked.json
279
+ - spec/fixtures/media_likes.json
280
+ - spec/fixtures/media_popular.json
281
+ - spec/fixtures/media_search.json
282
+ - spec/fixtures/media_unliked.json
283
+ - spec/fixtures/mikeyk.json
284
+ - spec/fixtures/recent_media.json
285
+ - spec/fixtures/requested_by.json
286
+ - spec/fixtures/shayne.json
287
+ - spec/fixtures/subscription.json
288
+ - spec/fixtures/subscription_deleted.json
289
+ - spec/fixtures/subscription_payload.json
290
+ - spec/fixtures/subscriptions.json
291
+ - spec/fixtures/tag.json
292
+ - spec/fixtures/tag_recent_media.json
293
+ - spec/fixtures/tag_search.json
294
+ - spec/fixtures/user_media_feed.json
295
+ - spec/fixtures/user_search.json
296
+ - spec/instagram/api_spec.rb
297
+ - spec/instagram/client/comments_spec.rb
298
+ - spec/instagram/client/likes_spec.rb
299
+ - spec/instagram/client/locations_spec.rb
300
+ - spec/instagram/client/media_spec.rb
301
+ - spec/instagram/client/real_time_spec.rb
302
+ - spec/instagram/client/subscriptions_spec.rb
303
+ - spec/instagram/client/tags_spec.rb
304
+ - spec/instagram/client/users_spec.rb
305
+ - spec/instagram/client_spec.rb
306
+ - spec/instagram_spec.rb
307
+ - spec/spec_helper.rb