twitter 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.yardopts +2 -0
  3. data/CHANGELOG.md +10 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/README.md +30 -20
  6. data/Rakefile +26 -5
  7. data/lib/twitter/arguments.rb +0 -1
  8. data/lib/twitter/base.rb +13 -16
  9. data/lib/twitter/basic_user.rb +3 -3
  10. data/lib/twitter/client.rb +7 -8
  11. data/lib/twitter/configuration.rb +5 -5
  12. data/lib/twitter/core_ext/enumerable.rb +0 -2
  13. data/lib/twitter/core_ext/kernel.rb +0 -2
  14. data/lib/twitter/creatable.rb +0 -1
  15. data/lib/twitter/cursor.rb +7 -10
  16. data/lib/twitter/direct_message.rb +1 -1
  17. data/lib/twitter/entity/uri.rb +2 -2
  18. data/lib/twitter/enumerable.rb +1 -2
  19. data/lib/twitter/error.rb +4 -6
  20. data/lib/twitter/error/already_favorited.rb +1 -1
  21. data/lib/twitter/error/already_posted.rb +1 -1
  22. data/lib/twitter/error/already_retweeted.rb +1 -1
  23. data/lib/twitter/error/too_many_requests.rb +2 -2
  24. data/lib/twitter/factory.rb +2 -6
  25. data/lib/twitter/geo.rb +1 -1
  26. data/lib/twitter/geo/point.rb +3 -5
  27. data/lib/twitter/geo_factory.rb +1 -5
  28. data/lib/twitter/geo_results.rb +5 -8
  29. data/lib/twitter/identity.rb +1 -2
  30. data/lib/twitter/list.rb +4 -5
  31. data/lib/twitter/media/photo.rb +1 -2
  32. data/lib/twitter/media_factory.rb +1 -5
  33. data/lib/twitter/null_object.rb +4 -6
  34. data/lib/twitter/oembed.rb +1 -1
  35. data/lib/twitter/place.rb +4 -5
  36. data/lib/twitter/profile_banner.rb +1 -3
  37. data/lib/twitter/rate_limit.rb +1 -3
  38. data/lib/twitter/relationship.rb +1 -2
  39. data/lib/twitter/rest/api/direct_messages.rb +13 -14
  40. data/lib/twitter/rest/api/favorites.rb +10 -11
  41. data/lib/twitter/rest/api/friends_and_followers.rb +36 -36
  42. data/lib/twitter/rest/api/help.rb +8 -9
  43. data/lib/twitter/rest/api/lists.rb +62 -63
  44. data/lib/twitter/rest/api/oauth.rb +3 -4
  45. data/lib/twitter/rest/api/places_and_geo.rb +9 -10
  46. data/lib/twitter/rest/api/saved_searches.rb +5 -6
  47. data/lib/twitter/rest/api/search.rb +2 -3
  48. data/lib/twitter/rest/api/spam_reporting.rb +1 -2
  49. data/lib/twitter/rest/api/suggested_users.rb +4 -5
  50. data/lib/twitter/rest/api/timelines.rb +17 -18
  51. data/lib/twitter/rest/api/trends.rb +10 -11
  52. data/lib/twitter/rest/api/tweets.rb +15 -16
  53. data/lib/twitter/rest/api/undocumented.rb +6 -7
  54. data/lib/twitter/rest/api/users.rb +51 -52
  55. data/lib/twitter/rest/api/utils.rb +23 -30
  56. data/lib/twitter/rest/client.rb +8 -9
  57. data/lib/twitter/rest/request/multipart_with_file.rb +0 -1
  58. data/lib/twitter/rest/response/parse_error_json.rb +0 -2
  59. data/lib/twitter/rest/response/parse_json.rb +0 -2
  60. data/lib/twitter/rest/response/raise_error.rb +1 -3
  61. data/lib/twitter/search_results.rb +12 -15
  62. data/lib/twitter/settings.rb +2 -2
  63. data/lib/twitter/size.rb +2 -2
  64. data/lib/twitter/source_user.rb +1 -1
  65. data/lib/twitter/streaming/client.rb +71 -18
  66. data/lib/twitter/streaming/connection.rb +1 -3
  67. data/lib/twitter/streaming/deleted_tweet.rb +8 -0
  68. data/lib/twitter/streaming/event.rb +8 -8
  69. data/lib/twitter/streaming/friend_list.rb +2 -9
  70. data/lib/twitter/streaming/message_parser.rb +13 -7
  71. data/lib/twitter/streaming/response.rb +0 -2
  72. data/lib/twitter/streaming/stall_warning.rb +7 -0
  73. data/lib/twitter/suggestion.rb +0 -1
  74. data/lib/twitter/token.rb +2 -3
  75. data/lib/twitter/trend_results.rb +5 -8
  76. data/lib/twitter/tweet.rb +16 -24
  77. data/lib/twitter/user.rb +30 -32
  78. data/lib/twitter/version.rb +2 -5
  79. data/spec/fixtures/track_streaming_user.json +2 -1
  80. data/spec/helper.rb +6 -2
  81. data/spec/twitter/base_spec.rb +9 -9
  82. data/spec/twitter/basic_user_spec.rb +6 -6
  83. data/spec/twitter/configuration_spec.rb +4 -4
  84. data/spec/twitter/cursor_spec.rb +27 -27
  85. data/spec/twitter/direct_message_spec.rb +36 -36
  86. data/spec/twitter/entity/uri_spec.rb +27 -27
  87. data/spec/twitter/error_spec.rb +21 -21
  88. data/spec/twitter/geo/point_spec.rb +9 -9
  89. data/spec/twitter/geo/polygon_spec.rb +5 -5
  90. data/spec/twitter/geo_factory_spec.rb +7 -7
  91. data/spec/twitter/geo_results_spec.rb +11 -11
  92. data/spec/twitter/geo_spec.rb +5 -5
  93. data/spec/twitter/identifiable_spec.rb +9 -9
  94. data/spec/twitter/list_spec.rb +38 -38
  95. data/spec/twitter/media/photo_spec.rb +54 -54
  96. data/spec/twitter/media_factory_spec.rb +5 -5
  97. data/spec/twitter/null_object_spec.rb +6 -6
  98. data/spec/twitter/oembed_spec.rb +65 -65
  99. data/spec/twitter/place_spec.rb +89 -60
  100. data/spec/twitter/profile_banner_spec.rb +3 -3
  101. data/spec/twitter/rate_limit_spec.rb +18 -18
  102. data/spec/twitter/relationship_spec.rb +16 -16
  103. data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
  104. data/spec/twitter/rest/api/favorites_spec.rb +93 -93
  105. data/spec/twitter/rest/api/friends_and_followers_spec.rb +349 -349
  106. data/spec/twitter/rest/api/geo_spec.rb +33 -33
  107. data/spec/twitter/rest/api/help_spec.rb +24 -24
  108. data/spec/twitter/rest/api/lists_spec.rb +487 -487
  109. data/spec/twitter/rest/api/oauth_spec.rb +30 -30
  110. data/spec/twitter/rest/api/saved_searches_spec.rb +40 -40
  111. data/spec/twitter/rest/api/search_spec.rb +16 -16
  112. data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
  113. data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
  114. data/spec/twitter/rest/api/timelines_spec.rb +58 -58
  115. data/spec/twitter/rest/api/trends_spec.rb +26 -26
  116. data/spec/twitter/rest/api/tweets_spec.rb +284 -284
  117. data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
  118. data/spec/twitter/rest/api/users_spec.rb +360 -360
  119. data/spec/twitter/rest/client_spec.rb +99 -103
  120. data/spec/twitter/saved_search_spec.rb +16 -16
  121. data/spec/twitter/search_results_spec.rb +44 -44
  122. data/spec/twitter/settings_spec.rb +8 -8
  123. data/spec/twitter/size_spec.rb +5 -5
  124. data/spec/twitter/source_user_spec.rb +6 -6
  125. data/spec/twitter/streaming/client_spec.rb +53 -49
  126. data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
  127. data/spec/twitter/streaming/event_spec.rb +20 -22
  128. data/spec/twitter/streaming/friend_list_spec.rb +11 -0
  129. data/spec/twitter/streaming/message_parser_spec.rb +54 -0
  130. data/spec/twitter/suggestion_spec.rb +11 -11
  131. data/spec/twitter/target_user_spec.rb +6 -6
  132. data/spec/twitter/token_spec.rb +4 -4
  133. data/spec/twitter/trend_results_spec.rb +30 -30
  134. data/spec/twitter/trend_spec.rb +20 -20
  135. data/spec/twitter/tweet_spec.rb +170 -173
  136. data/spec/twitter/user_spec.rb +179 -179
  137. data/twitter.gemspec +2 -2
  138. metadata +21 -4
  139. metadata.gz.sig +2 -1
@@ -3,64 +3,64 @@ require 'helper'
3
3
  describe Twitter::REST::API::OAuth do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS')
7
7
  end
8
8
 
9
- describe "#token" do
9
+ describe '#token' do
10
10
  before do
11
11
  # WebMock treats Basic Auth differently so we have to chack against the full URL with credentials.
12
- @oauth2_token_url = "https://CK:CS@api.twitter.com/oauth2/token"
13
- stub_request(:post, @oauth2_token_url).with(:body => "grant_type=client_credentials").to_return(:body => fixture("bearer_token.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ @oauth2_token_url = 'https://CK:CS@api.twitter.com/oauth2/token'
13
+ stub_request(:post, @oauth2_token_url).with(:body => 'grant_type=client_credentials').to_return(:body => fixture('bearer_token.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
14
14
  end
15
- it "requests the correct resource" do
15
+ it 'requests the correct resource' do
16
16
  @client.token
17
- expect(a_request(:post, @oauth2_token_url).with(:body => {:grant_type => "client_credentials"})).to have_been_made
17
+ expect(a_request(:post, @oauth2_token_url).with(:body => {:grant_type => 'client_credentials'})).to have_been_made
18
18
  end
19
- it "requests with the correct headers" do
19
+ it 'requests with the correct headers' do
20
20
  @client.token
21
- expect(a_request(:post, @oauth2_token_url).with(:headers => {:content_type => "application/x-www-form-urlencoded; charset=UTF-8", :accept => "*/*"})).to have_been_made
21
+ expect(a_request(:post, @oauth2_token_url).with(:headers => {:content_type => 'application/x-www-form-urlencoded; charset=UTF-8', :accept => '*/*'})).to have_been_made
22
22
  end
23
- it "returns the bearer token" do
23
+ it 'returns the bearer token' do
24
24
  bearer_token = @client.token
25
- expect(bearer_token.access_token).to eq("AAAA%2FAAA%3DAAAAAAAA")
26
- expect(bearer_token.token_type).to eq("bearer")
25
+ expect(bearer_token.access_token).to eq('AAAA%2FAAA%3DAAAAAAAA')
26
+ expect(bearer_token.token_type).to eq('bearer')
27
27
  end
28
28
  end
29
29
 
30
- describe "#invalidate_token" do
30
+ describe '#invalidate_token' do
31
31
  before do
32
- stub_post("/oauth2/invalidate_token").with(:body => {:access_token => "AAAA%2FAAA%3DAAAAAAAA"}).to_return(:body => '{"access_token" : "AAAA%2FAAA%3DAAAAAAAA"}', :headers => {:content_type => "application/json; charset=utf-8"})
33
- @client.bearer_token = "AAAA%2FAAA%3DAAAAAAAA"
32
+ stub_post('/oauth2/invalidate_token').with(:body => {:access_token => 'AAAA%2FAAA%3DAAAAAAAA'}).to_return(:body => '{"access_token":"AAAA%2FAAA%3DAAAAAAAA"}', :headers => {:content_type => 'application/json; charset=utf-8'})
33
+ @client.bearer_token = 'AAAA%2FAAA%3DAAAAAAAA'
34
34
  end
35
- it "requests the correct resource" do
36
- @client.invalidate_token("AAAA%2FAAA%3DAAAAAAAA")
37
- expect(a_post("/oauth2/invalidate_token").with(:body => {:access_token => "AAAA%2FAAA%3DAAAAAAAA"})).to have_been_made
35
+ it 'requests the correct resource' do
36
+ @client.invalidate_token('AAAA%2FAAA%3DAAAAAAAA')
37
+ expect(a_post('/oauth2/invalidate_token').with(:body => {:access_token => 'AAAA%2FAAA%3DAAAAAAAA'})).to have_been_made
38
38
  end
39
- it "returns the invalidated token" do
40
- token = @client.invalidate_token("AAAA%2FAAA%3DAAAAAAAA")
41
- expect(token.access_token).to eq("AAAA%2FAAA%3DAAAAAAAA")
39
+ it 'returns the invalidated token' do
40
+ token = @client.invalidate_token('AAAA%2FAAA%3DAAAAAAAA')
41
+ expect(token.access_token).to eq('AAAA%2FAAA%3DAAAAAAAA')
42
42
  expect(token.token_type).to be_nil
43
43
  end
44
- context "with a token" do
45
- it "requests the correct resource" do
46
- token = Twitter::Token.new(:access_token => "AAAA%2FAAA%3DAAAAAAAA")
44
+ context 'with a token' do
45
+ it 'requests the correct resource' do
46
+ token = Twitter::Token.new(:access_token => 'AAAA%2FAAA%3DAAAAAAAA')
47
47
  @client.invalidate_token(token)
48
- expect(a_post("/oauth2/invalidate_token").with(:body => {:access_token => "AAAA%2FAAA%3DAAAAAAAA"})).to have_been_made
48
+ expect(a_post('/oauth2/invalidate_token').with(:body => {:access_token => 'AAAA%2FAAA%3DAAAAAAAA'})).to have_been_made
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
- describe "#reverse_token" do
53
+ describe '#reverse_token' do
54
54
  before do
55
55
  # WebMock treats Basic Auth differently so we have to chack against the full URL with credentials.
56
- @oauth_request_token_url = "https://api.twitter.com/oauth/request_token?x_auth_mode=reverse_auth"
57
- stub_request(:post, @oauth_request_token_url).to_return(:body => fixture('request_token.txt'), :headers => {:content_type => "text/html; charset=utf-8"})
56
+ @oauth_request_token_url = 'https://api.twitter.com/oauth/request_token?x_auth_mode=reverse_auth'
57
+ stub_request(:post, @oauth_request_token_url).to_return(:body => fixture('request_token.txt'), :headers => {:content_type => 'text/html; charset=utf-8'})
58
58
  end
59
- it "requests the correct resource" do
59
+ it 'requests the correct resource' do
60
60
  @client.reverse_token
61
- expect(a_request(:post, @oauth_request_token_url).with(:params => {:x_auth_mode => "reverse_auth"})).to have_been_made
61
+ expect(a_request(:post, @oauth_request_token_url).with(:params => {:x_auth_mode => 'reverse_auth'})).to have_been_made
62
62
  end
63
- it "requests the correct resource" do
63
+ it 'requests the correct resource' do
64
64
  expect(@client.reverse_token).to eql fixture('request_token.txt').read
65
65
  end
66
66
  end
@@ -3,85 +3,85 @@ require 'helper'
3
3
  describe Twitter::REST::API::SavedSearches do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#saved_searches" do
10
- context "with ids passed" do
9
+ describe '#saved_searches' do
10
+ context 'with ids passed' do
11
11
  before do
12
- stub_get("/1.1/saved_searches/show/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ stub_get('/1.1/saved_searches/show/16129012.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
13
  end
14
- it "requests the correct resource" do
15
- @client.saved_searches(16129012)
16
- expect(a_get("/1.1/saved_searches/show/16129012.json")).to have_been_made
14
+ it 'requests the correct resource' do
15
+ @client.saved_searches(16_129_012)
16
+ expect(a_get('/1.1/saved_searches/show/16129012.json')).to have_been_made
17
17
  end
18
- it "returns an array of saved searches" do
19
- saved_searches = @client.saved_searches(16129012)
18
+ it 'returns an array of saved searches' do
19
+ saved_searches = @client.saved_searches(16_129_012)
20
20
  expect(saved_searches).to be_an Array
21
21
  expect(saved_searches.first).to be_a Twitter::SavedSearch
22
- expect(saved_searches.first.name).to eq("twitter")
22
+ expect(saved_searches.first.name).to eq('twitter')
23
23
  end
24
24
  end
25
- context "without ids passed" do
25
+ context 'without ids passed' do
26
26
  before do
27
- stub_get("/1.1/saved_searches/list.json").to_return(:body => fixture("saved_searches.json"), :headers => {:content_type => "application/json; charset=utf-8"})
27
+ stub_get('/1.1/saved_searches/list.json').to_return(:body => fixture('saved_searches.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
28
28
  end
29
- it "requests the correct resource" do
29
+ it 'requests the correct resource' do
30
30
  @client.saved_searches
31
- expect(a_get("/1.1/saved_searches/list.json")).to have_been_made
31
+ expect(a_get('/1.1/saved_searches/list.json')).to have_been_made
32
32
  end
33
- it "returns the authenticated user's saved search queries" do
33
+ it 'returns the saved search queries for the authenticated user' do
34
34
  saved_searches = @client.saved_searches
35
35
  expect(saved_searches).to be_an Array
36
36
  expect(saved_searches.first).to be_a Twitter::SavedSearch
37
- expect(saved_searches.first.name).to eq("twitter")
37
+ expect(saved_searches.first.name).to eq('twitter')
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
- describe "#saved_search" do
42
+ describe '#saved_search' do
43
43
  before do
44
- stub_get("/1.1/saved_searches/show/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
44
+ stub_get('/1.1/saved_searches/show/16129012.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
45
45
  end
46
- it "requests the correct resource" do
47
- @client.saved_search(16129012)
48
- expect(a_get("/1.1/saved_searches/show/16129012.json")).to have_been_made
46
+ it 'requests the correct resource' do
47
+ @client.saved_search(16_129_012)
48
+ expect(a_get('/1.1/saved_searches/show/16129012.json')).to have_been_made
49
49
  end
50
- it "returns a saved search" do
51
- saved_search = @client.saved_search(16129012)
50
+ it 'returns a saved search' do
51
+ saved_search = @client.saved_search(16_129_012)
52
52
  expect(saved_search).to be_a Twitter::SavedSearch
53
- expect(saved_search.name).to eq("twitter")
53
+ expect(saved_search.name).to eq('twitter')
54
54
  end
55
55
  end
56
56
 
57
- describe "#create_saved_search" do
57
+ describe '#create_saved_search' do
58
58
  before do
59
- stub_post("/1.1/saved_searches/create.json").with(:body => {:query => "twitter"}).to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
59
+ stub_post('/1.1/saved_searches/create.json').with(:body => {:query => 'twitter'}).to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
60
60
  end
61
- it "requests the correct resource" do
62
- @client.create_saved_search("twitter")
63
- expect(a_post("/1.1/saved_searches/create.json").with(:body => {:query => "twitter"})).to have_been_made
61
+ it 'requests the correct resource' do
62
+ @client.create_saved_search('twitter')
63
+ expect(a_post('/1.1/saved_searches/create.json').with(:body => {:query => 'twitter'})).to have_been_made
64
64
  end
65
- it "returns the created saved search" do
66
- saved_search = @client.create_saved_search("twitter")
65
+ it 'returns the created saved search' do
66
+ saved_search = @client.create_saved_search('twitter')
67
67
  expect(saved_search).to be_a Twitter::SavedSearch
68
- expect(saved_search.name).to eq("twitter")
68
+ expect(saved_search.name).to eq('twitter')
69
69
  end
70
70
  end
71
71
 
72
- describe "#destroy_saved_search" do
72
+ describe '#destroy_saved_search' do
73
73
  before do
74
- stub_post("/1.1/saved_searches/destroy/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
74
+ stub_post('/1.1/saved_searches/destroy/16129012.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
75
75
  end
76
- it "requests the correct resource" do
77
- @client.destroy_saved_search(16129012)
78
- expect(a_post("/1.1/saved_searches/destroy/16129012.json")).to have_been_made
76
+ it 'requests the correct resource' do
77
+ @client.destroy_saved_search(16_129_012)
78
+ expect(a_post('/1.1/saved_searches/destroy/16129012.json')).to have_been_made
79
79
  end
80
- it "returns an array of deleted saved searches" do
81
- saved_searches = @client.destroy_saved_search(16129012)
80
+ it 'returns an array of deleted saved searches' do
81
+ saved_searches = @client.destroy_saved_search(16_129_012)
82
82
  expect(saved_searches).to be_an Array
83
83
  expect(saved_searches.first).to be_a Twitter::SavedSearch
84
- expect(saved_searches.first.name).to eq("twitter")
84
+ expect(saved_searches.first.name).to eq('twitter')
85
85
  end
86
86
  end
87
87
 
@@ -3,35 +3,35 @@ require 'helper'
3
3
  describe Twitter::REST::API::Search do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#search" do
9
+ describe '#search' do
10
10
  before do
11
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
11
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
12
12
  end
13
- it "requests the correct resource" do
14
- @client.search("twitter")
15
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"})).to have_been_made
13
+ it 'requests the correct resource' do
14
+ @client.search('twitter')
15
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter'})).to have_been_made
16
16
  end
17
- it "returns recent Tweets related to a query with images and videos embedded" do
18
- search = @client.search("twitter")
17
+ it 'returns recent Tweets related to a query with images and videos embedded' do
18
+ search = @client.search('twitter')
19
19
  expect(search).to be_a Twitter::SearchResults
20
20
  expect(search.first).to be_a Twitter::Tweet
21
- expect(search.first.text).to eq("Bubble Mailer #freebandnames")
21
+ expect(search.first.text).to eq('Bubble Mailer #freebandnames')
22
22
  end
23
- it "returns the max_id value for a search result" do
24
- search = @client.search("twitter")
25
- expect(search.max_id).to eq(250126199840518145)
23
+ it 'returns the max_id value for a search result' do
24
+ search = @client.search('twitter')
25
+ expect(search.max_id).to eq(250_126_199_840_518_145)
26
26
  end
27
27
 
28
- context "when search API responds a malformed result" do
28
+ context 'when search API responds a malformed result' do
29
29
  before do
30
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"}).to_return(:body => fixture("search_malformed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
30
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter'}).to_return(:body => fixture('search_malformed.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
31
31
  end
32
32
 
33
- it "returns an empty array" do
34
- search = @client.search("twitter")
33
+ it 'returns an empty array' do
34
+ search = @client.search('twitter')
35
35
  expect(search.to_a).to be_an Array
36
36
  expect(search.to_a).to be_empty
37
37
  end
@@ -3,22 +3,22 @@ require 'helper'
3
3
  describe Twitter::REST::API::SpamReporting do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#report_spam" do
9
+ describe '#report_spam' do
10
10
  before do
11
- stub_post("/1.1/users/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
11
+ stub_post('/1.1/users/report_spam.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
12
12
  end
13
- it "requests the correct resource" do
14
- @client.report_spam("sferik")
15
- expect(a_post("/1.1/users/report_spam.json").with(:body => {:screen_name => "sferik"})).to have_been_made
13
+ it 'requests the correct resource' do
14
+ @client.report_spam('sferik')
15
+ expect(a_post('/1.1/users/report_spam.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
16
16
  end
17
- it "returns an array of users" do
18
- users = @client.report_spam("sferik")
17
+ it 'returns an array of users' do
18
+ users = @client.report_spam('sferik')
19
19
  expect(users).to be_an Array
20
20
  expect(users.first).to be_a Twitter::User
21
- expect(users.first.id).to eq(7505382)
21
+ expect(users.first.id).to eq(7_505_382)
22
22
  end
23
23
  end
24
24
 
@@ -3,53 +3,53 @@ require 'helper'
3
3
  describe Twitter::REST::API::SuggestedUsers do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#suggestions" do
10
- context "with a category slug passed" do
9
+ describe '#suggestions' do
10
+ context 'with a category slug passed' do
11
11
  before do
12
- stub_get("/1.1/users/suggestions/art-design.json").to_return(:body => fixture("category.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ stub_get('/1.1/users/suggestions/art-design.json').to_return(:body => fixture('category.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
13
  end
14
- it "requests the correct resource" do
15
- @client.suggestions("art-design")
16
- expect(a_get("/1.1/users/suggestions/art-design.json")).to have_been_made
14
+ it 'requests the correct resource' do
15
+ @client.suggestions('art-design')
16
+ expect(a_get('/1.1/users/suggestions/art-design.json')).to have_been_made
17
17
  end
18
- it "returns the users in a given category of the Twitter suggested user list" do
19
- suggestion = @client.suggestions("art-design")
18
+ it 'returns the users in a given category of the Twitter suggested user list' do
19
+ suggestion = @client.suggestions('art-design')
20
20
  expect(suggestion).to be_a Twitter::Suggestion
21
- expect(suggestion.name).to eq("Art & Design")
21
+ expect(suggestion.name).to eq('Art & Design')
22
22
  expect(suggestion.users).to be_an Array
23
23
  expect(suggestion.users.first).to be_a Twitter::User
24
24
  end
25
25
  end
26
- context "without arguments passed" do
26
+ context 'without arguments passed' do
27
27
  before do
28
- stub_get("/1.1/users/suggestions.json").to_return(:body => fixture("suggestions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
28
+ stub_get('/1.1/users/suggestions.json').to_return(:body => fixture('suggestions.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
29
29
  end
30
- it "requests the correct resource" do
30
+ it 'requests the correct resource' do
31
31
  @client.suggestions
32
- expect(a_get("/1.1/users/suggestions.json")).to have_been_made
32
+ expect(a_get('/1.1/users/suggestions.json')).to have_been_made
33
33
  end
34
- it "returns the list of suggested user categories" do
34
+ it 'returns the list of suggested user categories' do
35
35
  suggestions = @client.suggestions
36
36
  expect(suggestions).to be_an Array
37
37
  expect(suggestions.first).to be_a Twitter::Suggestion
38
- expect(suggestions.first.name).to eq("Art & Design")
38
+ expect(suggestions.first.name).to eq('Art & Design')
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
- describe "#suggest_users" do
43
+ describe '#suggest_users' do
44
44
  before do
45
- stub_get("/1.1/users/suggestions/art-design/members.json").to_return(:body => fixture("members.json"), :headers => {:content_type => "application/json; charset=utf-8"})
45
+ stub_get('/1.1/users/suggestions/art-design/members.json').to_return(:body => fixture('members.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
46
46
  end
47
- it "requests the correct resource" do
48
- @client.suggest_users("art-design")
49
- expect(a_get("/1.1/users/suggestions/art-design/members.json")).to have_been_made
47
+ it 'requests the correct resource' do
48
+ @client.suggest_users('art-design')
49
+ expect(a_get('/1.1/users/suggestions/art-design/members.json')).to have_been_made
50
50
  end
51
- it "returns users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user" do
52
- suggest_users = @client.suggest_users("art-design")
51
+ it 'returns users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user' do
52
+ suggest_users = @client.suggest_users('art-design')
53
53
  expect(suggest_users).to be_an Array
54
54
  expect(suggest_users.first).to be_a Twitter::User
55
55
  expect(suggest_users.first.id).to eq(13)
@@ -3,135 +3,135 @@ require 'helper'
3
3
  describe Twitter::REST::API::Timelines do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#mentions_timeline" do
9
+ describe '#mentions_timeline' do
10
10
  before do
11
- stub_get("/1.1/statuses/mentions_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
11
+ stub_get('/1.1/statuses/mentions_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
12
12
  end
13
- it "requests the correct resource" do
13
+ it 'requests the correct resource' do
14
14
  @client.mentions_timeline
15
- expect(a_get("/1.1/statuses/mentions_timeline.json")).to have_been_made
15
+ expect(a_get('/1.1/statuses/mentions_timeline.json')).to have_been_made
16
16
  end
17
- it "returns the 20 most recent mentions (status containing @username) for the authenticating user" do
17
+ it 'returns the 20 most recent mentions (status containing @username) for the authenticating user' do
18
18
  tweets = @client.mentions_timeline
19
19
  expect(tweets).to be_an Array
20
20
  expect(tweets.first).to be_a Twitter::Tweet
21
- expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!")
21
+ expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
22
22
  end
23
23
  end
24
24
 
25
- describe "#user_timeline" do
26
- context "with a screen name passed" do
25
+ describe '#user_timeline' do
26
+ context 'with a screen name passed' do
27
27
  before do
28
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
28
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
29
29
  end
30
- it "requests the correct resource" do
31
- @client.user_timeline("sferik")
32
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"})).to have_been_made
30
+ it 'requests the correct resource' do
31
+ @client.user_timeline('sferik')
32
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'})).to have_been_made
33
33
  end
34
- it "returns the 20 most recent Tweets posted by the user specified by screen name or user id" do
35
- tweets = @client.user_timeline("sferik")
34
+ it 'returns the 20 most recent Tweets posted by the user specified by screen name or user id' do
35
+ tweets = @client.user_timeline('sferik')
36
36
  expect(tweets).to be_an Array
37
37
  expect(tweets.first).to be_a Twitter::Tweet
38
- expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!")
38
+ expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
39
39
  end
40
40
  end
41
- context "without a screen name passed" do
41
+ context 'without a screen name passed' do
42
42
  before do
43
- stub_get("/1.1/statuses/user_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
43
+ stub_get('/1.1/statuses/user_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
44
44
  end
45
- it "requests the correct resource" do
45
+ it 'requests the correct resource' do
46
46
  @client.user_timeline
47
- expect(a_get("/1.1/statuses/user_timeline.json")).to have_been_made
47
+ expect(a_get('/1.1/statuses/user_timeline.json')).to have_been_made
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
- describe "#retweeted_by_user" do
52
+ describe '#retweeted_by_user' do
53
53
  before do
54
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
55
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
54
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
55
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
56
56
  end
57
- it "requests the correct resource" do
58
- @client.retweeted_by_user("sferik")
59
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200"})).to have_been_made
60
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
57
+ it 'requests the correct resource' do
58
+ @client.retweeted_by_user('sferik')
59
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200'})).to have_been_made
60
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :screen_name => 'sferik', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
61
61
  end
62
- it "returns the 20 most recent retweets posted by the authenticating user" do
63
- tweets = @client.retweeted_by_user("sferik")
62
+ it 'returns the 20 most recent retweets posted by the authenticating user' do
63
+ tweets = @client.retweeted_by_user('sferik')
64
64
  expect(tweets).to be_an Array
65
65
  expect(tweets.first).to be_a Twitter::Tweet
66
- expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k")
66
+ expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
67
67
  end
68
68
  end
69
69
 
70
- describe "#retweeted_by_me" do
70
+ describe '#retweeted_by_me' do
71
71
  before do
72
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
73
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
72
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
73
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
74
74
  end
75
- it "requests the correct resource" do
75
+ it 'requests the correct resource' do
76
76
  @client.retweeted_by_me
77
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200"})).to have_been_made
78
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
77
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200'})).to have_been_made
78
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
79
79
  end
80
- it "returns the 20 most recent retweets posted by the authenticating user" do
80
+ it 'returns the 20 most recent retweets posted by the authenticating user' do
81
81
  tweets = @client.retweeted_by_me
82
82
  expect(tweets).to be_an Array
83
83
  expect(tweets.first).to be_a Twitter::Tweet
84
- expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k")
84
+ expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
85
85
  end
86
86
  end
87
87
 
88
- describe "#home_timeline" do
88
+ describe '#home_timeline' do
89
89
  before do
90
- stub_get("/1.1/statuses/home_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
90
+ stub_get('/1.1/statuses/home_timeline.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
91
91
  end
92
- it "requests the correct resource" do
92
+ it 'requests the correct resource' do
93
93
  @client.home_timeline
94
- expect(a_get("/1.1/statuses/home_timeline.json")).to have_been_made
94
+ expect(a_get('/1.1/statuses/home_timeline.json')).to have_been_made
95
95
  end
96
- it "returns the 20 most recent Tweets, including retweets if they exist, posted by the authenticating user and the user's they follow" do
96
+ it 'returns the 20 most recent Tweets, including retweets if they exist, posted by the authenticating user and the users they follow' do
97
97
  tweets = @client.home_timeline
98
98
  expect(tweets).to be_an Array
99
99
  expect(tweets.first).to be_a Twitter::Tweet
100
- expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!")
100
+ expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
101
101
  end
102
102
  end
103
103
 
104
- describe "#retweeted_to_me" do
104
+ describe '#retweeted_to_me' do
105
105
  before do
106
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
107
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
106
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
107
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
108
108
  end
109
- it "requests the correct resource" do
109
+ it 'requests the correct resource' do
110
110
  @client.retweeted_to_me
111
- expect(stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200"})).to have_been_made
112
- expect(stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
111
+ expect(stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200'})).to have_been_made
112
+ expect(stub_get('/1.1/statuses/home_timeline.json').with(:query => {:include_rts => 'true', :count => '200', :max_id => '244102729860009983'})).to have_been_made.times(3)
113
113
  end
114
- it "returns the 20 most recent retweets posted by users the authenticating user follow" do
114
+ it 'returns the 20 most recent retweets posted by users the authenticating user follow' do
115
115
  tweets = @client.retweeted_to_me
116
116
  expect(tweets).to be_an Array
117
117
  expect(tweets.first).to be_a Twitter::Tweet
118
- expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k")
118
+ expect(tweets.first.text).to eq('RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k')
119
119
  end
120
120
  end
121
121
 
122
- describe "#retweets_of_me" do
122
+ describe '#retweets_of_me' do
123
123
  before do
124
- stub_get("/1.1/statuses/retweets_of_me.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
124
+ stub_get('/1.1/statuses/retweets_of_me.json').to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
125
125
  end
126
- it "requests the correct resource" do
126
+ it 'requests the correct resource' do
127
127
  @client.retweets_of_me
128
- expect(a_get("/1.1/statuses/retweets_of_me.json")).to have_been_made
128
+ expect(a_get('/1.1/statuses/retweets_of_me.json')).to have_been_made
129
129
  end
130
- it "returns the 20 most recent tweets of the authenticated user that have been retweeted by others" do
130
+ it 'returns the 20 most recent tweets of the authenticated user that have been retweeted by others' do
131
131
  tweets = @client.retweets_of_me
132
132
  expect(tweets).to be_an Array
133
133
  expect(tweets.first).to be_a Twitter::Tweet
134
- expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!")
134
+ expect(tweets.first.text).to eq('Happy Birthday @imdane. Watch out for those @rally pranksters!')
135
135
  end
136
136
  end
137
137