instagram-continued 1.3.0 → 1.3.1

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -0
  3. data/.travis.yml +1 -0
  4. data/README.md +1 -1
  5. data/Rakefile +12 -11
  6. data/instagram-continued.gemspec +6 -5
  7. data/lib/faraday/loud_logger.rb +47 -48
  8. data/lib/faraday/oauth2.rb +16 -18
  9. data/lib/faraday/raise_http_exception.rb +9 -9
  10. data/lib/instagram.rb +8 -8
  11. data/lib/instagram/api.rb +4 -4
  12. data/lib/instagram/client.rb +1 -1
  13. data/lib/instagram/client/comments.rb +5 -5
  14. data/lib/instagram/client/embedding.rb +9 -9
  15. data/lib/instagram/client/likes.rb +5 -5
  16. data/lib/instagram/client/locations.rb +4 -4
  17. data/lib/instagram/client/media.rb +3 -3
  18. data/lib/instagram/client/subscriptions.rb +27 -27
  19. data/lib/instagram/client/tags.rb +3 -3
  20. data/lib/instagram/client/users.rb +19 -19
  21. data/lib/instagram/client/utils.rb +5 -5
  22. data/lib/instagram/configuration.rb +7 -6
  23. data/lib/instagram/connection.rb +7 -7
  24. data/lib/instagram/oauth.rb +8 -8
  25. data/lib/instagram/request.rb +23 -26
  26. data/lib/instagram/response.rb +8 -4
  27. data/lib/instagram/version.rb +1 -1
  28. data/spec/faraday/response_spec.rb +23 -25
  29. data/spec/instagram/api_spec.rb +90 -94
  30. data/spec/instagram/client/comments_spec.rb +21 -25
  31. data/spec/instagram/client/embedding_spec.rb +8 -8
  32. data/spec/instagram/client/geography_spec.rb +10 -13
  33. data/spec/instagram/client/likes_spec.rb +21 -25
  34. data/spec/instagram/client/locations_spec.rb +42 -48
  35. data/spec/instagram/client/media_spec.rb +33 -37
  36. data/spec/instagram/client/subscriptions_spec.rb +34 -46
  37. data/spec/instagram/client/tags_spec.rb +29 -33
  38. data/spec/instagram/client/users_spec.rb +155 -180
  39. data/spec/instagram/client/utils_spec.rb +8 -9
  40. data/spec/instagram/client_spec.rb +9 -9
  41. data/spec/instagram/request_spec.rb +27 -27
  42. data/spec/instagram_spec.rb +20 -24
  43. data/spec/spec_helper.rb +10 -10
  44. metadata +24 -9
@@ -1,26 +1,24 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
-
7
6
  before do
8
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
9
8
  end
10
9
 
11
10
  describe ".media_comments" do
12
-
13
11
  before do
14
- stub_get("media/777/comments.#{format}").
15
- with(:query => {:access_token => @client.access_token}).
16
- to_return(:body => fixture("media_comments.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
12
+ stub_get("media/777/comments.#{format}")
13
+ .with(query: { access_token: @client.access_token })
14
+ .to_return(body: fixture("media_comments.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
17
15
  end
18
16
 
19
17
  it "should get the correct resource" do
20
18
  @client.media_comments(777)
21
- expect(a_get("media/777/comments.#{format}").
22
- with(:query => {:access_token => @client.access_token})).
23
- to have_been_made
19
+ expect(a_get("media/777/comments.#{format}")
20
+ .with(query: { access_token: @client.access_token }))
21
+ .to have_been_made
24
22
  end
25
23
 
26
24
  it "should return an array of user search results" do
@@ -31,18 +29,17 @@ describe Instagram::Client do
31
29
  end
32
30
 
33
31
  describe ".create_media_comment" do
34
-
35
32
  before do
36
- stub_post("media/777/comments.#{format}").
37
- with(:body => {:text => "hi there", :access_token => @client.access_token}).
38
- to_return(:body => fixture("media_comment.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
33
+ stub_post("media/777/comments.#{format}")
34
+ .with(body: { text: "hi there", access_token: @client.access_token })
35
+ .to_return(body: fixture("media_comment.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
39
36
  end
40
37
 
41
38
  it "should get the correct resource" do
42
39
  @client.create_media_comment(777, "hi there")
43
- expect(a_post("media/777/comments.#{format}").
44
- with(:body => {:text => "hi there", :access_token => @client.access_token})).
45
- to have_been_made
40
+ expect(a_post("media/777/comments.#{format}")
41
+ .with(body: { text: "hi there", access_token: @client.access_token }))
42
+ .to have_been_made
46
43
  end
47
44
 
48
45
  it "should return the new comment when successful" do
@@ -52,20 +49,19 @@ describe Instagram::Client do
52
49
  end
53
50
 
54
51
  describe ".delete_media_comment" do
55
-
56
52
  before do
57
- stub_delete("media/777/comments/1234.#{format}").
58
- with(:query => {:access_token => @client.access_token}).
59
- to_return(:body => fixture("media_comment_deleted.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
53
+ stub_delete("media/777/comments/1234.#{format}")
54
+ .with(query: { access_token: @client.access_token })
55
+ .to_return(body: fixture("media_comment_deleted.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
60
56
  end
61
57
 
62
58
  it "should get the correct resource" do
63
59
  @client.delete_media_comment(777, 1234)
64
- expect(a_delete("media/777/comments/1234.#{format}").
65
- with(:query => {:access_token => @client.access_token})).
66
- to have_been_made
60
+ expect(a_delete("media/777/comments/1234.#{format}")
61
+ .with(query: { access_token: @client.access_token }))
62
+ .to have_been_made
67
63
  end
68
64
  end
69
65
  end
70
66
  end
71
- end
67
+ end
@@ -1,24 +1,24 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
6
  before do
7
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
8
8
  end
9
9
 
10
10
  describe ".oembed" do
11
11
  before do
12
- stub_get("oembed").
13
- with(:query => {:access_token => @client.access_token, :url => "http://instagram.com/p/abcdef"}).
14
- to_return(:body => fixture("oembed.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
12
+ stub_get("oembed")
13
+ .with(query: { access_token: @client.access_token, url: "http://instagram.com/p/abcdef" })
14
+ .to_return(body: fixture("oembed.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
15
15
  end
16
16
 
17
17
  it "should get the correct resource" do
18
18
  @client.oembed("http://instagram.com/p/abcdef")
19
- expect(a_get("oembed?url=http://instagram.com/p/abcdef").
20
- with(:query => {:access_token => @client.access_token})).
21
- to have_been_made
19
+ expect(a_get("oembed?url=http://instagram.com/p/abcdef")
20
+ .with(query: { access_token: @client.access_token }))
21
+ .to have_been_made
22
22
  end
23
23
 
24
24
  it "should return the oembed information for an instagram media url" do
@@ -1,32 +1,29 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
6
  before do
7
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
8
8
  end
9
9
 
10
-
11
10
  describe ".geography_recent_media" do
12
-
13
11
  context "with geography ID passed" do
14
-
15
12
  before do
16
- stub_get("geographies/12345/media/recent.#{format}").
17
- with(:query => {:access_token => @client.access_token}).
18
- to_return(:body => fixture("geography_recent_media.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
13
+ stub_get("geographies/12345/media/recent.#{format}")
14
+ .with(query: { access_token: @client.access_token })
15
+ .to_return(body: fixture("geography_recent_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
19
16
  end
20
17
 
21
18
  it "should get the correct resource" do
22
- @client.geography_recent_media(12345)
23
- expect(a_get("geographies/12345/media/recent.#{format}").
24
- with(:query => {:access_token => @client.access_token})).
25
- to have_been_made
19
+ @client.geography_recent_media(12_345)
20
+ expect(a_get("geographies/12345/media/recent.#{format}")
21
+ .with(query: { access_token: @client.access_token }))
22
+ .to have_been_made
26
23
  end
27
24
 
28
25
  it "should return a list of recent media items within the specifed geography" do
29
- recent_media = @client.geography_recent_media(12345)
26
+ recent_media = @client.geography_recent_media(12_345)
30
27
  expect(recent_media).to be_a Array
31
28
  expect(recent_media.first.user.username).to eq("amandavan")
32
29
  end
@@ -1,26 +1,24 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
-
7
6
  before do
8
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :client_ips => '1.2.3.4', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", client_ips: "1.2.3.4", access_token: "AT")
9
8
  end
10
9
 
11
10
  describe ".media_likes" do
12
-
13
11
  before do
14
- stub_get("media/777/likes.#{format}").
15
- with(:query => {:access_token => @client.access_token}).
16
- to_return(:body => fixture("media_likes.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
12
+ stub_get("media/777/likes.#{format}")
13
+ .with(query: { access_token: @client.access_token })
14
+ .to_return(body: fixture("media_likes.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
17
15
  end
18
16
 
19
17
  it "should get the correct resource" do
20
18
  @client.media_likes(777)
21
- expect(a_get("media/777/likes.#{format}").
22
- with(:query => {:access_token => @client.access_token})).
23
- to have_been_made
19
+ expect(a_get("media/777/likes.#{format}")
20
+ .with(query: { access_token: @client.access_token }))
21
+ .to have_been_made
24
22
  end
25
23
 
26
24
  it "should return an array of user search results" do
@@ -31,36 +29,34 @@ describe Instagram::Client do
31
29
  end
32
30
 
33
31
  describe ".like_media" do
34
-
35
32
  before do
36
- stub_post("media/777/likes.#{format}").
37
- with(:body => {:access_token => @client.access_token}).
38
- to_return(:body => fixture("media_liked.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
33
+ stub_post("media/777/likes.#{format}")
34
+ .with(body: { access_token: @client.access_token })
35
+ .to_return(body: fixture("media_liked.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
39
36
  end
40
37
 
41
38
  it "should get the correct resource" do
42
39
  @client.like_media(777)
43
- expect(a_post("media/777/likes.#{format}").
44
- with(:body => {:access_token => @client.access_token})).
45
- to have_been_made
40
+ expect(a_post("media/777/likes.#{format}")
41
+ .with(body: { access_token: @client.access_token }))
42
+ .to have_been_made
46
43
  end
47
44
  end
48
45
 
49
46
  describe ".unlike_media" do
50
-
51
47
  before do
52
- stub_delete("media/777/likes.#{format}").
53
- with(:query => {:access_token => @client.access_token}).
54
- to_return(:body => fixture("media_unliked.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
48
+ stub_delete("media/777/likes.#{format}")
49
+ .with(query: { access_token: @client.access_token })
50
+ .to_return(body: fixture("media_unliked.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
55
51
  end
56
52
 
57
53
  it "should get the correct resource" do
58
54
  @client.unlike_media(777)
59
- expect(a_delete("media/777/likes.#{format}").
60
- with(:query => {:access_token => @client.access_token})).
61
- to have_been_made
55
+ expect(a_delete("media/777/likes.#{format}")
56
+ .with(query: { access_token: @client.access_token }))
57
+ .to have_been_made
62
58
  end
63
59
  end
64
60
  end
65
61
  end
66
- end
62
+ end
@@ -1,70 +1,67 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
6
  before do
7
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
8
8
  end
9
9
 
10
10
  describe ".location" do
11
-
12
11
  before do
13
- stub_get("locations/514276.#{format}").
14
- with(:query => {:access_token => @client.access_token}).
15
- to_return(:body => fixture("location.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
12
+ stub_get("locations/514276.#{format}")
13
+ .with(query: { access_token: @client.access_token })
14
+ .to_return(body: fixture("location.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
16
15
  end
17
16
 
18
17
  it "should get the correct resource" do
19
- @client.location(514276)
20
- expect(a_get("locations/514276.#{format}").
21
- with(:query => {:access_token => @client.access_token})).
22
- to have_been_made
18
+ @client.location(514_276)
19
+ expect(a_get("locations/514276.#{format}")
20
+ .with(query: { access_token: @client.access_token }))
21
+ .to have_been_made
23
22
  end
24
23
 
25
24
  it "should return extended information of a given location" do
26
- location = @client.location(514276)
25
+ location = @client.location(514_276)
27
26
  expect(location.name).to eq("Instagram")
28
27
  end
29
28
  end
30
29
 
31
30
  describe ".location_recent_media" do
32
-
33
31
  before do
34
- stub_get("locations/514276/media/recent.#{format}").
35
- with(:query => {:access_token => @client.access_token}).
36
- to_return(:body => fixture("location_recent_media.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
32
+ stub_get("locations/514276/media/recent.#{format}")
33
+ .with(query: { access_token: @client.access_token })
34
+ .to_return(body: fixture("location_recent_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
37
35
  end
38
36
 
39
37
  it "should get the correct resource" do
40
- @client.location_recent_media(514276)
41
- expect(a_get("locations/514276/media/recent.#{format}").
42
- with(:query => {:access_token => @client.access_token})).
43
- to have_been_made
38
+ @client.location_recent_media(514_276)
39
+ expect(a_get("locations/514276/media/recent.#{format}")
40
+ .with(query: { access_token: @client.access_token }))
41
+ .to have_been_made
44
42
  end
45
43
 
46
44
  it "should return a list of media taken at a given location" do
47
- media = @client.location_recent_media(514276)
45
+ media = @client.location_recent_media(514_276)
48
46
  expect(media).to be_a Array
49
47
  expect(media.first.user.username).to eq("josh")
50
48
  end
51
49
  end
52
50
 
53
51
  describe ".location_search_lat_lng" do
54
-
55
52
  before do
56
- stub_get("locations/search.#{format}").
57
- with(:query => {:access_token => @client.access_token}).
58
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
59
- to_return(:body => fixture("location_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
53
+ stub_get("locations/search.#{format}")
54
+ .with(query: { access_token: @client.access_token })
55
+ .with(query: { lat: "37.7808851", lng: "-122.3948632" })
56
+ .to_return(body: fixture("location_search.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
60
57
  end
61
58
 
62
59
  it "should get the correct resource by lat/lng" do
63
60
  @client.location_search("37.7808851", "-122.3948632")
64
- expect(a_get("locations/search.#{format}").
65
- with(:query => {:access_token => @client.access_token}).
66
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632"})).
67
- to have_been_made
61
+ expect(a_get("locations/search.#{format}")
62
+ .with(query: { access_token: @client.access_token })
63
+ .with(query: { lat: "37.7808851", lng: "-122.3948632" }))
64
+ .to have_been_made
68
65
  end
69
66
 
70
67
  it "should return an array of user search results" do
@@ -75,20 +72,19 @@ describe Instagram::Client do
75
72
  end
76
73
 
77
74
  describe ".location_search_lat_lng_distance" do
78
-
79
75
  before do
80
- stub_get("locations/search.#{format}").
81
- with(:query => {:access_token => @client.access_token}).
82
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632", :distance => "5000"}).
83
- to_return(:body => fixture("location_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
76
+ stub_get("locations/search.#{format}")
77
+ .with(query: { access_token: @client.access_token })
78
+ .with(query: { lat: "37.7808851", lng: "-122.3948632", distance: "5000" })
79
+ .to_return(body: fixture("location_search.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
84
80
  end
85
81
 
86
82
  it "should get the correct resource by lat/lng/distance" do
87
83
  @client.location_search("37.7808851", "-122.3948632", "5000")
88
- expect(a_get("locations/search.#{format}").
89
- with(:query => {:access_token => @client.access_token}).
90
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632", :distance => "5000"})).
91
- to have_been_made
84
+ expect(a_get("locations/search.#{format}")
85
+ .with(query: { access_token: @client.access_token })
86
+ .with(query: { lat: "37.7808851", lng: "-122.3948632", distance: "5000" }))
87
+ .to have_been_made
92
88
  end
93
89
 
94
90
  it "should return an array of user search results" do
@@ -99,20 +95,19 @@ describe Instagram::Client do
99
95
  end
100
96
 
101
97
  describe ".location_search_facebook_places_id" do
102
-
103
98
  before do
104
- stub_get("locations/search.#{format}").
105
- with(:query => {:access_token => @client.access_token}).
106
- with(:query => {:facebook_places_id => "3fd66200f964a520c5f11ee3"}).
107
- to_return(:body => fixture("location_search_facebook.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
99
+ stub_get("locations/search.#{format}")
100
+ .with(query: { access_token: @client.access_token })
101
+ .with(query: { facebook_places_id: "3fd66200f964a520c5f11ee3" })
102
+ .to_return(body: fixture("location_search_facebook.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
108
103
  end
109
104
 
110
105
  it "should get the correct resource by facebook_places_id" do
111
106
  @client.location_search("3fd66200f964a520c5f11ee3")
112
- expect(a_get("locations/search.#{format}").
113
- with(:query => {:access_token => @client.access_token}).
114
- with(:query => {:facebook_places_id => "3fd66200f964a520c5f11ee3"})).
115
- to have_been_made
107
+ expect(a_get("locations/search.#{format}")
108
+ .with(query: { access_token: @client.access_token })
109
+ .with(query: { facebook_places_id: "3fd66200f964a520c5f11ee3" }))
110
+ .to have_been_made
116
111
  end
117
112
 
118
113
  it "should return an array of user search results" do
@@ -121,7 +116,6 @@ describe Instagram::Client do
121
116
  expect(locations.first.name).to eq("Schiller's Liquor Bar")
122
117
  end
123
118
  end
124
-
125
119
  end
126
120
  end
127
121
  end
@@ -1,67 +1,64 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
1
+ require File.expand_path("../../../spec_helper", __FILE__)
2
2
 
3
3
  describe Instagram::Client do
4
4
  Instagram::Configuration::VALID_FORMATS.each do |format|
5
5
  context ".new(:format => '#{format}')" do
6
6
  before do
7
- @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
7
+ @client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
8
8
  end
9
9
 
10
10
  describe ".media_item" do
11
-
12
11
  before do
13
- stub_get("media/18600493.#{format}").
14
- with(:query => {:access_token => @client.access_token}).
15
- to_return(:body => fixture("media.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
12
+ stub_get("media/18600493.#{format}")
13
+ .with(query: { access_token: @client.access_token })
14
+ .to_return(body: fixture("media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
16
15
  end
17
16
 
18
17
  it "should get the correct resource" do
19
- @client.media_item(18600493)
20
- expect(a_get("media/18600493.#{format}").
21
- with(:query => {:access_token => @client.access_token})).
22
- to have_been_made
18
+ @client.media_item(18_600_493)
19
+ expect(a_get("media/18600493.#{format}")
20
+ .with(query: { access_token: @client.access_token }))
21
+ .to have_been_made
23
22
  end
24
23
 
25
24
  it "should return extended information of a given media item" do
26
- media = @client.media_item(18600493)
25
+ media = @client.media_item(18_600_493)
27
26
  expect(media.user.username).to eq("mikeyk")
28
27
  end
29
28
  end
30
29
 
31
30
  describe ".media_shortcode" do
32
-
33
31
  before do
34
- stub_get('media/shortcode/BG9It').
35
- with(:query => {:access_token => @client.access_token}).
36
- to_return(:body => fixture("media_shortcode.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
32
+ stub_get("media/shortcode/BG9It")
33
+ .with(query: { access_token: @client.access_token })
34
+ .to_return(body: fixture("media_shortcode.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
37
35
  end
38
36
 
39
37
  it "should get the correct resource" do
40
- @client.media_shortcode('BG9It')
41
- expect(a_get('media/shortcode/BG9It').
42
- with(:query => {:access_token => @client.access_token})).
43
- to have_been_made
38
+ @client.media_shortcode("BG9It")
39
+ expect(a_get("media/shortcode/BG9It")
40
+ .with(query: { access_token: @client.access_token }))
41
+ .to have_been_made
44
42
  end
45
43
 
46
44
  it "should return extended information of a given media item" do
47
- media = @client.media_shortcode('BG9It')
48
- expect(media.user.username).to eq('mikeyk')
45
+ media = @client.media_shortcode("BG9It")
46
+ expect(media.user.username).to eq("mikeyk")
49
47
  end
50
48
  end
51
49
 
52
50
  describe ".media_popular" do
53
-
54
51
  before do
55
- stub_get("media/popular.#{format}").
56
- with(:query => {:access_token => @client.access_token}).
57
- to_return(:body => fixture("media_popular.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
52
+ stub_get("media/popular.#{format}")
53
+ .with(query: { access_token: @client.access_token })
54
+ .to_return(body: fixture("media_popular.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
58
55
  end
59
56
 
60
57
  it "should get the correct resource" do
61
58
  @client.media_popular
62
- expect(a_get("media/popular.#{format}").
63
- with(:query => {:access_token => @client.access_token})).
64
- to have_been_made
59
+ expect(a_get("media/popular.#{format}")
60
+ .with(query: { access_token: @client.access_token }))
61
+ .to have_been_made
65
62
  end
66
63
 
67
64
  it "should return popular media items" do
@@ -72,20 +69,19 @@ describe Instagram::Client do
72
69
  end
73
70
 
74
71
  describe ".media_search" do
75
-
76
72
  before do
77
- stub_get("media/search.#{format}").
78
- with(:query => {:access_token => @client.access_token}).
79
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
80
- to_return(:body => fixture("media_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
73
+ stub_get("media/search.#{format}")
74
+ .with(query: { access_token: @client.access_token })
75
+ .with(query: { lat: "37.7808851", lng: "-122.3948632" })
76
+ .to_return(body: fixture("media_search.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
81
77
  end
82
78
 
83
79
  it "should get the correct resource" do
84
80
  @client.media_search("37.7808851", "-122.3948632")
85
- expect(a_get("media/search.#{format}").
86
- with(:query => {:access_token => @client.access_token}).
87
- with(:query => {:lat => "37.7808851", :lng => "-122.3948632"})).
88
- to have_been_made
81
+ expect(a_get("media/search.#{format}")
82
+ .with(query: { access_token: @client.access_token })
83
+ .with(query: { lat: "37.7808851", lng: "-122.3948632" }))
84
+ .to have_been_made
89
85
  end
90
86
 
91
87
  it "should return an array of user search results" do