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
@@ -2,12 +2,12 @@ require 'helper'
2
2
 
3
3
  describe Twitter::Token do
4
4
 
5
- describe "#bearer?" do
6
- it "returns true when token is a bearer token" do
7
- token = Twitter::Token.new(:token_type => "bearer")
5
+ describe '#bearer?' do
6
+ it 'returns true when token is a bearer token' do
7
+ token = Twitter::Token.new(:token_type => 'bearer')
8
8
  expect(token.bearer?).to be true
9
9
  end
10
- it "returns false when token type is nil" do
10
+ it 'returns false when token type is nil' do
11
11
  token = Twitter::Token.new
12
12
  expect(token.bearer?).to be false
13
13
  end
@@ -2,85 +2,85 @@ require 'helper'
2
2
 
3
3
  describe Twitter::TrendResults do
4
4
 
5
- describe "#as_of" do
6
- it "returns a Time when as_of is set" do
7
- trend_results = Twitter::TrendResults.new(:id => 1, :as_of => "2012-08-24T23:25:43Z")
5
+ describe '#as_of' do
6
+ it 'returns a Time when as_of is set' do
7
+ trend_results = Twitter::TrendResults.new(:id => 1, :as_of => '2012-08-24T23:25:43Z')
8
8
  expect(trend_results.as_of).to be_a Time
9
9
  end
10
- it "returns nil when as_of is not set" do
10
+ it 'returns nil when as_of is not set' do
11
11
  trend_results = Twitter::TrendResults.new(:id => 1)
12
12
  expect(trend_results.as_of).to be_nil
13
13
  end
14
14
  end
15
15
 
16
- describe "#as_of?" do
17
- it "returns true when as_of is set" do
18
- trend_results = Twitter::TrendResults.new(:id => 1, :as_of => "2012-08-24T23:24:14Z")
16
+ describe '#as_of?' do
17
+ it 'returns true when as_of is set' do
18
+ trend_results = Twitter::TrendResults.new(:id => 1, :as_of => '2012-08-24T23:24:14Z')
19
19
  expect(trend_results.as_of?).to be true
20
20
  end
21
- it "returns false when as_of is not set" do
21
+ it 'returns false when as_of is not set' do
22
22
  trend_results = Twitter::TrendResults.new(:id => 1)
23
23
  expect(trend_results.as_of?).to be false
24
24
  end
25
25
  end
26
26
 
27
- describe "#created_at" do
28
- it "returns a Time when created_at is set" do
29
- trend_results = Twitter::TrendResults.new(:id => 1, :created_at => "2012-08-24T23:24:14Z")
27
+ describe '#created_at' do
28
+ it 'returns a Time when created_at is set' do
29
+ trend_results = Twitter::TrendResults.new(:id => 1, :created_at => '2012-08-24T23:24:14Z')
30
30
  expect(trend_results.created_at).to be_a Time
31
31
  end
32
- it "returns nil when created_at is not set" do
32
+ it 'returns nil when created_at is not set' do
33
33
  trend_results = Twitter::TrendResults.new(:id => 1)
34
34
  expect(trend_results.created_at).to be_nil
35
35
  end
36
36
  end
37
37
 
38
- describe "#created?" do
39
- it "returns true when created_at is set" do
40
- trend_results = Twitter::TrendResults.new(:id => 1, :created_at => "2012-08-24T23:24:14Z")
38
+ describe '#created?' do
39
+ it 'returns true when created_at is set' do
40
+ trend_results = Twitter::TrendResults.new(:id => 1, :created_at => '2012-08-24T23:24:14Z')
41
41
  expect(trend_results.created?).to be true
42
42
  end
43
- it "returns false when created_at is not set" do
43
+ it 'returns false when created_at is not set' do
44
44
  trend_results = Twitter::TrendResults.new(:id => 1)
45
45
  expect(trend_results.created?).to be false
46
46
  end
47
47
  end
48
48
 
49
- describe "#each" do
49
+ describe '#each' do
50
50
  before do
51
51
  @trend_results = Twitter::TrendResults.new(:trends => [{:id => 1}, {:id => 2}, {:id => 3}, {:id => 4}, {:id => 5}, {:id => 6}])
52
52
  end
53
- it "iterates" do
53
+ it 'iterates' do
54
54
  count = 0
55
- @trend_results.each{count += 1}
55
+ @trend_results.each { count += 1 }
56
56
  expect(count).to eq(6)
57
57
  end
58
- context "with start" do
59
- it "iterates" do
58
+ context 'with start' do
59
+ it 'iterates' do
60
60
  count = 0
61
- @trend_results.each(5){count += 1}
61
+ @trend_results.each(5) { count += 1 }
62
62
  expect(count).to eq(1)
63
63
  end
64
64
  end
65
65
  end
66
66
 
67
- describe "#location" do
68
- it "returns a Twitter::Place when location is set" do
69
- trend_results = Twitter::TrendResults.new(:id => 1, :locations => [{:name => "Worldwide", :woeid => 1}])
67
+ describe '#location' do
68
+ it 'returns a Twitter::Place when location is set' do
69
+ trend_results = Twitter::TrendResults.new(:id => 1, :locations => [{:name => 'Worldwide', :woeid => 1}])
70
70
  expect(trend_results.location).to be_a Twitter::Place
71
71
  end
72
- it "returns nil when location is not set" do
72
+ it 'returns nil when location is not set' do
73
73
  trend_results = Twitter::TrendResults.new(:id => 1)
74
74
  expect(trend_results.location).to be_nil
75
75
  end
76
76
  end
77
77
 
78
- describe "#location?" do
79
- it "returns true when location is set" do
80
- trend_results = Twitter::TrendResults.new(:id => 1, :locations => [{:name => "Worldwide", :woeid => 1}])
78
+ describe '#location?' do
79
+ it 'returns true when location is set' do
80
+ trend_results = Twitter::TrendResults.new(:id => 1, :locations => [{:name => 'Worldwide', :woeid => 1}])
81
81
  expect(trend_results.location?).to be true
82
82
  end
83
- it "returns false when location is not set" do
83
+ it 'returns false when location is not set' do
84
84
  trend_results = Twitter::TrendResults.new(:id => 1)
85
85
  expect(trend_results.location?).to be false
86
86
  end
@@ -2,47 +2,47 @@ require 'helper'
2
2
 
3
3
  describe Twitter::Trend do
4
4
 
5
- describe "#==" do
6
- it "returns true for empty objects" do
5
+ describe '#==' do
6
+ it 'returns true for empty objects' do
7
7
  trend = Twitter::Trend.new
8
8
  other = Twitter::Trend.new
9
9
  expect(trend == other).to be true
10
10
  end
11
- it "returns true when objects names are the same" do
12
- trend = Twitter::Trend.new(:name => "#sevenwordsaftersex", :query => "foo")
13
- other = Twitter::Trend.new(:name => "#sevenwordsaftersex", :query => "bar")
11
+ it 'returns true when objects names are the same' do
12
+ trend = Twitter::Trend.new(:name => '#sevenwordsaftersex', :query => 'foo')
13
+ other = Twitter::Trend.new(:name => '#sevenwordsaftersex', :query => 'bar')
14
14
  expect(trend == other).to be true
15
15
  end
16
- it "returns false when objects names are different" do
17
- trend = Twitter::Trend.new(:name => "#sevenwordsaftersex")
18
- other = Twitter::Trend.new(:name => "#sixwordsaftersex")
16
+ it 'returns false when objects names are different' do
17
+ trend = Twitter::Trend.new(:name => '#sevenwordsaftersex')
18
+ other = Twitter::Trend.new(:name => '#sixwordsaftersex')
19
19
  expect(trend == other).to be false
20
20
  end
21
- it "returns false when classes are different" do
22
- trend = Twitter::Trend.new(:name => "#sevenwordsaftersex")
23
- other = Twitter::Base.new(:name => "#sevenwordsaftersex")
21
+ it 'returns false when classes are different' do
22
+ trend = Twitter::Trend.new(:name => '#sevenwordsaftersex')
23
+ other = Twitter::Base.new(:name => '#sevenwordsaftersex')
24
24
  expect(trend == other).to be false
25
25
  end
26
26
  end
27
27
 
28
- describe "#uri" do
29
- it "returns a URI when the url is set" do
30
- trend = Twitter::Trend.new(:url => "http://twitter.com/search/?q=%23sevenwordsaftersex")
28
+ describe '#uri' do
29
+ it 'returns a URI when the url is set' do
30
+ trend = Twitter::Trend.new(:url => 'http://twitter.com/search/?q=%23sevenwordsaftersex')
31
31
  expect(trend.uri).to be_a Addressable::URI
32
- expect(trend.uri.to_s).to eq("http://twitter.com/search/?q=%23sevenwordsaftersex")
32
+ expect(trend.uri.to_s).to eq('http://twitter.com/search/?q=%23sevenwordsaftersex')
33
33
  end
34
- it "returns nil when the url is not set" do
34
+ it 'returns nil when the url is not set' do
35
35
  trend = Twitter::Trend.new
36
36
  expect(trend.uri).to be_nil
37
37
  end
38
38
  end
39
39
 
40
- describe "#uri?" do
41
- it "returns true when the url is set" do
42
- trend = Twitter::Trend.new(:url => "https://api.twitter.com/1.1/geo/id/247f43d441defc03.json")
40
+ describe '#uri?' do
41
+ it 'returns true when the url is set' do
42
+ trend = Twitter::Trend.new(:url => 'https://api.twitter.com/1.1/geo/id/247f43d441defc03.json')
43
43
  expect(trend.uri?).to be true
44
44
  end
45
- it "returns false when the url is not set" do
45
+ it 'returns false when the url is not set' do
46
46
  trend = Twitter::Trend.new
47
47
  expect(trend.uri?).to be false
48
48
  end
@@ -12,381 +12,378 @@ describe Twitter::Tweet do
12
12
  $stderr = @old_stderr
13
13
  end
14
14
 
15
- describe "#==" do
16
- it "returns true when objects IDs are the same" do
17
- tweet = Twitter::Tweet.new(:id => 1, :text => "foo")
18
- other = Twitter::Tweet.new(:id => 1, :text => "bar")
15
+ describe '#==' do
16
+ it 'returns true when objects IDs are the same' do
17
+ tweet = Twitter::Tweet.new(:id => 1, :text => 'foo')
18
+ other = Twitter::Tweet.new(:id => 1, :text => 'bar')
19
19
  expect(tweet == other).to be true
20
20
  end
21
- it "returns false when objects IDs are different" do
21
+ it 'returns false when objects IDs are different' do
22
22
  tweet = Twitter::Tweet.new(:id => 1)
23
23
  other = Twitter::Tweet.new(:id => 2)
24
24
  expect(tweet == other).to be false
25
25
  end
26
- it "returns false when classes are different" do
26
+ it 'returns false when classes are different' do
27
27
  tweet = Twitter::Tweet.new(:id => 1)
28
28
  other = Twitter::Identity.new(:id => 1)
29
29
  expect(tweet == other).to be false
30
30
  end
31
31
  end
32
32
 
33
- describe "#created_at" do
34
- it "returns a Time when set" do
35
- tweet = Twitter::Tweet.new(:id => 28669546014, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
33
+ describe '#created_at' do
34
+ it 'returns a Time when set' do
35
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :created_at => 'Mon Jul 16 12:59:01 +0000 2007')
36
36
  expect(tweet.created_at).to be_a Time
37
37
  end
38
- it "returns nil when not set" do
39
- tweet = Twitter::Tweet.new(:id => 28669546014)
38
+ it 'returns nil when not set' do
39
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
40
40
  expect(tweet.created_at).to be_nil
41
41
  end
42
42
  end
43
43
 
44
- describe "#created?" do
45
- it "returns true when created_at is set" do
46
- tweet = Twitter::Tweet.new(:id => 28669546014, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
44
+ describe '#created?' do
45
+ it 'returns true when created_at is set' do
46
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :created_at => 'Mon Jul 16 12:59:01 +0000 2007')
47
47
  expect(tweet.created?).to be true
48
48
  end
49
- it "returns false when created_at is not set" do
50
- tweet = Twitter::Tweet.new(:id => 28669546014)
49
+ it 'returns false when created_at is not set' do
50
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
51
51
  expect(tweet.created?).to be false
52
52
  end
53
53
  end
54
54
 
55
- describe "#entities?" do
56
- it "returns false if there are no entities set" do
57
- tweet = Twitter::Tweet.new(:id => 28669546014)
55
+ describe '#entities?' do
56
+ it 'returns false if there are no entities set' do
57
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
58
58
  expect(tweet.entities?).to be false
59
59
  end
60
60
 
61
- it "returns false if there are blank lists of entities set" do
62
- tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => []})
61
+ it 'returns false if there are blank lists of entities set' do
62
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:urls => []})
63
63
  expect(tweet.entities?).to be false
64
64
  end
65
-
66
- it "returns true if there are entities set" do
65
+ it 'returns true if there are entities set' do
67
66
  urls_array = [
68
67
  {
69
- :url => "http://example.com/t.co",
70
- :expanded_url => "http://example.com/expanded",
71
- :display_url => "example.com/expanded…",
68
+ :url => 'http://example.com/t.co',
69
+ :expanded_url => 'http://example.com/expanded',
70
+ :display_url => 'example.com/expanded…',
72
71
  :indices => [10, 33],
73
72
  }
74
73
  ]
75
- tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => urls_array})
74
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:urls => urls_array})
76
75
  expect(tweet.entities?).to be true
77
76
  end
78
77
  end
79
78
 
80
- describe "#filter_level" do
81
- it "returns the filter level when filter_level is set" do
82
- tweet = Twitter::Tweet.new(:id => 28669546014, :filter_level => "high")
79
+ describe '#filter_level' do
80
+ it 'returns the filter level when filter_level is set' do
81
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :filter_level => 'high')
83
82
  expect(tweet.filter_level).to be_a String
84
- expect(tweet.filter_level).to eq("high")
83
+ expect(tweet.filter_level).to eq('high')
85
84
  end
86
- it "returns \"none\" when not set" do
87
- tweet = Twitter::Tweet.new(:id => 28669546014)
88
- expect(tweet.filter_level).to eq("none")
85
+ it 'returns \'none\' when not set' do
86
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
87
+ expect(tweet.filter_level).to eq('none')
89
88
  end
90
89
  end
91
90
 
92
- describe "#full_text" do
93
- it "returns the text of a Tweet" do
94
- tweet = Twitter::Tweet.new(:id => 28669546014, :text => "BOOSH")
91
+ describe '#full_text' do
92
+ it 'returns the text of a Tweet' do
93
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :text => 'BOOSH')
95
94
  expect(tweet.full_text).to be_a String
96
- expect(tweet.full_text).to eq("BOOSH")
95
+ expect(tweet.full_text).to eq('BOOSH')
97
96
  end
98
- it "returns the text of a Tweet without a user" do
99
- tweet = Twitter::Tweet.new(:id => 28669546014, :text => "BOOSH", :retweeted_status => {:id => 28561922517, :text => "BOOSH"})
97
+ it 'returns the text of a Tweet without a user' do
98
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :text => 'BOOSH', :retweeted_status => {:id => 28_561_922_517, :text => 'BOOSH'})
100
99
  expect(tweet.full_text).to be_a String
101
- expect(tweet.full_text).to eq("BOOSH")
100
+ expect(tweet.full_text).to eq('BOOSH')
102
101
  end
103
- it "returns the full text of a retweeted Tweet" do
104
- tweet = Twitter::Tweet.new(:id => 28669546014, :text => "RT @sferik: BOOSH", :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
102
+ it 'returns the full text of a retweeted Tweet' do
103
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :text => 'RT @sferik: BOOSH', :retweeted_status => {:id => 25_938_088_801, :text => 'BOOSH'})
105
104
  expect(tweet.full_text).to be_a String
106
- expect(tweet.full_text).to eq("RT @sferik: BOOSH")
105
+ expect(tweet.full_text).to eq('RT @sferik: BOOSH')
107
106
  end
108
- it "returns nil when retweeted_status is not set" do
109
- tweet = Twitter::Tweet.new(:id => 28669546014)
107
+ it 'returns nil when retweeted_status is not set' do
108
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
110
109
  expect(tweet.full_text).to be_nil
111
110
  end
112
111
  end
113
112
 
114
- describe "#geo" do
115
- it "returns a Twitter::Geo::Point when geo is set" do
116
- tweet = Twitter::Tweet.new(:id => 28669546014, :geo => {:id => 1, :type => "Point"})
113
+ describe '#geo' do
114
+ it 'returns a Twitter::Geo::Point when geo is set' do
115
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :geo => {:id => 1, :type => 'Point'})
117
116
  expect(tweet.geo).to be_a Twitter::Geo::Point
118
117
  end
119
- it "returns nil when geo is not set" do
120
- tweet = Twitter::Tweet.new(:id => 28669546014)
118
+ it 'returns nil when geo is not set' do
119
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
121
120
  expect(tweet.geo).to be_nil
122
121
  end
123
122
  end
124
123
 
125
- describe "#geo?" do
126
- it "returns true when geo is set" do
127
- tweet = Twitter::Tweet.new(:id => 28669546014, :geo => {:id => 1, :type => "Point"})
124
+ describe '#geo?' do
125
+ it 'returns true when geo is set' do
126
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :geo => {:id => 1, :type => 'Point'})
128
127
  expect(tweet.geo?).to be true
129
128
  end
130
- it "returns false when geo is not set" do
131
- tweet = Twitter::Tweet.new(:id => 28669546014)
129
+ it 'returns false when geo is not set' do
130
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
132
131
  expect(tweet.geo?).to be false
133
132
  end
134
133
  end
135
134
 
136
- describe "#hashtags" do
137
- it "returns an array of Entity::Hashtag when entities are set" do
135
+ describe '#hashtags' do
136
+ it 'returns an array of Entity::Hashtag when entities are set' do
138
137
  hashtags_array = [
139
138
  {
140
- :text => "twitter",
139
+ :text => 'twitter',
141
140
  :indices => [10, 33],
142
141
  }
143
142
  ]
144
- hashtags = Twitter::Tweet.new(:id => 28669546014, :entities => {:hashtags => hashtags_array}).hashtags
143
+ hashtags = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:hashtags => hashtags_array}).hashtags
145
144
  expect(hashtags).to be_an Array
146
145
  expect(hashtags.first).to be_a Twitter::Entity::Hashtag
147
146
  expect(hashtags.first.indices).to eq([10, 33])
148
- expect(hashtags.first.text).to eq("twitter")
147
+ expect(hashtags.first.text).to eq('twitter')
149
148
  end
150
- it "is empty when not set" do
151
- hashtags = Twitter::Tweet.new(:id => 28669546014).hashtags
149
+ it 'is empty when not set' do
150
+ hashtags = Twitter::Tweet.new(:id => 28_669_546_014).hashtags
152
151
  expect(hashtags).to be_empty
153
152
  end
154
- it "warns when not set" do
155
- Twitter::Tweet.new(:id => 28669546014).hashtags
153
+ it 'warns when not set' do
154
+ Twitter::Tweet.new(:id => 28_669_546_014).hashtags
156
155
  expect($stderr.string).to match(/To get hashtags, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
157
156
  end
158
157
  end
159
158
 
160
- describe "#media" do
161
- it "returns media" do
162
- media = Twitter::Tweet.new(:id => 28669546014, :entities => {:media => [{:id => 1, :type => "photo"}]}).media
159
+ describe '#media' do
160
+ it 'returns media' do
161
+ media = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:media => [{:id => 1, :type => 'photo'}]}).media
163
162
  expect(media).to be_an Array
164
163
  expect(media.first).to be_a Twitter::Media::Photo
165
164
  end
166
- it "is empty when not set" do
167
- media = Twitter::Tweet.new(:id => 28669546014).media
165
+ it 'is empty when not set' do
166
+ media = Twitter::Tweet.new(:id => 28_669_546_014).media
168
167
  expect(media).to be_empty
169
168
  end
170
- it "warns when not set" do
171
- Twitter::Tweet.new(:id => 28669546014).media
169
+ it 'warns when not set' do
170
+ Twitter::Tweet.new(:id => 28_669_546_014).media
172
171
  expect($stderr.string).to match(/To get media, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
173
172
  end
174
173
  end
175
174
 
176
- describe "#metadata" do
177
- it "returns a Twitter::Metadata when metadata is set" do
178
- tweet = Twitter::Tweet.new(:id => 28669546014, :metadata => {})
175
+ describe '#metadata' do
176
+ it 'returns a Twitter::Metadata when metadata is set' do
177
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :metadata => {})
179
178
  expect(tweet.metadata).to be_a Twitter::Metadata
180
179
  end
181
- it "returns nil when metadata is not set" do
182
- tweet = Twitter::Tweet.new(:id => 28669546014)
180
+ it 'returns nil when metadata is not set' do
181
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
183
182
  expect(tweet.metadata).to be_nil
184
183
  end
185
184
  end
186
185
 
187
- describe "#metadata?" do
188
- it "returns true when metadata is set" do
189
- tweet = Twitter::Tweet.new(:id => 28669546014, :metadata => {})
186
+ describe '#metadata?' do
187
+ it 'returns true when metadata is set' do
188
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :metadata => {})
190
189
  expect(tweet.metadata?).to be true
191
190
  end
192
- it "returns false when metadata is not set" do
193
- tweet = Twitter::Tweet.new(:id => 28669546014)
191
+ it 'returns false when metadata is not set' do
192
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
194
193
  expect(tweet.metadata?).to be false
195
194
  end
196
195
  end
197
196
 
198
- describe "#place" do
199
- it "returns a Twitter::Place when place is set" do
200
- tweet = Twitter::Tweet.new(:id => 28669546014, :place => {:id => "247f43d441defc03"})
197
+ describe '#place' do
198
+ it 'returns a Twitter::Place when place is set' do
199
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :place => {:id => '247f43d441defc03'})
201
200
  expect(tweet.place).to be_a Twitter::Place
202
201
  end
203
- it "returns nil when place is not set" do
204
- tweet = Twitter::Tweet.new(:id => 28669546014)
202
+ it 'returns nil when place is not set' do
203
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
205
204
  expect(tweet.place).to be_nil
206
205
  end
207
206
  end
208
207
 
209
- describe "#place?" do
210
- it "returns true when place is set" do
211
- tweet = Twitter::Tweet.new(:id => 28669546014, :place => {:id => "247f43d441defc03"})
208
+ describe '#place?' do
209
+ it 'returns true when place is set' do
210
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :place => {:id => '247f43d441defc03'})
212
211
  expect(tweet.place?).to be true
213
212
  end
214
- it "returns false when place is not set" do
215
- tweet = Twitter::Tweet.new(:id => 28669546014)
213
+ it 'returns false when place is not set' do
214
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
216
215
  expect(tweet.place?).to be false
217
216
  end
218
217
  end
219
218
 
220
- describe "#reply?" do
221
- it "returns true when there is an in-reply-to status" do
222
- tweet = Twitter::Tweet.new(:id => 28669546014, :in_reply_to_status_id => 114749583439036416)
219
+ describe '#reply?' do
220
+ it 'returns true when there is an in-reply-to status' do
221
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :in_reply_to_status_id => 114_749_583_439_036_416)
223
222
  expect(tweet.reply?).to be true
224
223
  end
225
- it "returns false when in_reply_to_status_id is not set" do
226
- tweet = Twitter::Tweet.new(:id => 28669546014)
224
+ it 'returns false when in_reply_to_status_id is not set' do
225
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
227
226
  expect(tweet.reply?).to be false
228
227
  end
229
228
  end
230
229
 
231
- describe "#retweet?" do
232
- it "returns true when there is a retweeted status" do
233
- tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
230
+ describe '#retweet?' do
231
+ it 'returns true when there is a retweeted status' do
232
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :retweeted_status => {:id => 25_938_088_801, :text => 'BOOSH'})
234
233
  expect(tweet.retweet?).to be true
235
234
  end
236
- it "returns false when retweeted_status is not set" do
237
- tweet = Twitter::Tweet.new(:id => 28669546014)
235
+ it 'returns false when retweeted_status is not set' do
236
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
238
237
  expect(tweet.retweet?).to be false
239
238
  end
240
239
  end
241
240
 
242
- describe "#retweeted_status" do
243
- it "returns a Tweet when retweeted_status is set" do
244
- tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
241
+ describe '#retweeted_status' do
242
+ it 'returns a Tweet when retweeted_status is set' do
243
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :retweeted_status => {:id => 25_938_088_801, :text => 'BOOSH'})
245
244
  expect(tweet.retweeted_tweet).to be_a Twitter::Tweet
246
- expect(tweet.retweeted_tweet.text).to eq("BOOSH")
245
+ expect(tweet.retweeted_tweet.text).to eq('BOOSH')
247
246
  end
248
- it "returns nil when retweeted_status is not set" do
249
- tweet = Twitter::Tweet.new(:id => 28669546014)
247
+ it 'returns nil when retweeted_status is not set' do
248
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
250
249
  expect(tweet.retweeted_tweet).to be_nil
251
250
  end
252
251
  end
253
252
 
254
- describe "#retweeted_status?" do
255
- it "returns true when retweeted_status is set" do
256
- tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"})
253
+ describe '#retweeted_status?' do
254
+ it 'returns true when retweeted_status is set' do
255
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :retweeted_status => {:id => 25_938_088_801, :text => 'BOOSH'})
257
256
  expect(tweet.retweeted_status?).to be true
258
257
  end
259
- it "returns false when retweeted_status is not set" do
260
- tweet = Twitter::Tweet.new(:id => 28669546014)
258
+ it 'returns false when retweeted_status is not set' do
259
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
261
260
  expect(tweet.retweeted_status?).to be false
262
261
  end
263
262
  end
264
263
 
265
- describe "#symbols" do
266
- it "returns an array of Entity::Symbol when symbols are set" do
264
+ describe '#symbols' do
265
+ it 'returns an array of Entity::Symbol when symbols are set' do
267
266
  symbols_array = [
268
- { :text => "PEP", :indices => [114, 118] },
269
- { :text => "COKE", :indices => [128, 133] }
267
+ {:text => 'PEP', :indices => [114, 118]},
268
+ {:text => 'COKE', :indices => [128, 133]}
270
269
  ]
271
- symbols = Twitter::Tweet.new(:id => 28669546014, :entities => {:symbols => symbols_array}).symbols
270
+ symbols = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:symbols => symbols_array}).symbols
272
271
  expect(symbols).to be_an Array
273
272
  expect(symbols.size).to eq(2)
274
273
  expect(symbols.first).to be_a Twitter::Entity::Symbol
275
274
  expect(symbols.first.indices).to eq([114, 118])
276
- expect(symbols.first.text).to eq("PEP")
275
+ expect(symbols.first.text).to eq('PEP')
277
276
  end
278
- it "is empty when not set" do
279
- symbols = Twitter::Tweet.new(:id => 28669546014).symbols
277
+ it 'is empty when not set' do
278
+ symbols = Twitter::Tweet.new(:id => 28_669_546_014).symbols
280
279
  expect(symbols).to be_empty
281
280
  end
282
- it "warns when not set" do
283
- Twitter::Tweet.new(:id => 28669546014).symbols
281
+ it 'warns when not set' do
282
+ Twitter::Tweet.new(:id => 28_669_546_014).symbols
284
283
  expect($stderr.string).to match(/To get symbols, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
285
284
  end
286
285
  end
287
286
 
288
- describe "#uris" do
289
- it "returns an array of Entity::URIs when entities are set" do
287
+ describe '#uris' do
288
+ it 'returns an array of Entity::URIs when entities are set' do
290
289
  urls_array = [
291
290
  {
292
- :url => "http://example.com/t.co",
293
- :expanded_url => "http://example.com/expanded",
294
- :display_url => "example.com/expanded…",
291
+ :url => 'http://example.com/t.co',
292
+ :expanded_url => 'http://example.com/expanded',
293
+ :display_url => 'example.com/expanded…',
295
294
  :indices => [10, 33],
296
295
  }
297
296
  ]
298
- tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => urls_array})
297
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:urls => urls_array})
299
298
  expect(tweet.uris).to be_an Array
300
299
  expect(tweet.uris.first).to be_a Twitter::Entity::URI
301
300
  expect(tweet.uris.first.indices).to eq([10, 33])
302
301
  expect(tweet.uris.first.display_uri).to be_a String
303
- expect(tweet.uris.first.display_uri).to eq("example.com/expanded…")
302
+ expect(tweet.uris.first.display_uri).to eq('example.com/expanded…')
304
303
  end
305
- it "is empty when not set" do
306
- tweet = Twitter::Tweet.new(:id => 28669546014)
304
+ it 'is empty when not set' do
305
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
307
306
  expect(tweet.uris).to be_empty
308
307
  end
309
- it "warns when not set" do
310
- Twitter::Tweet.new(:id => 28669546014).urls
308
+ it 'warns when not set' do
309
+ Twitter::Tweet.new(:id => 28_669_546_014).urls
311
310
  expect($stderr.string).to match(/To get urls, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
312
311
  end
313
-
314
- it "can handle strange urls" do
312
+ it 'can handle strange urls' do
315
313
  urls_array = [
316
314
  {
317
- :url => "http://with_underscore.example.com/t.co",
318
- :expanded_url => "http://with_underscore.example.com/expanded",
319
- :display_url => "with_underscore.example.com/expanded…",
315
+ :url => 'http://with_underscore.example.com/t.co',
316
+ :expanded_url => 'http://with_underscore.example.com/expanded',
317
+ :display_url => 'with_underscore.example.com/expanded…',
320
318
  :indices => [10, 33],
321
319
  }
322
320
  ]
323
- tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => urls_array})
321
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:urls => urls_array})
324
322
  uri = tweet.uris.first
325
- expect{ uri.url }.to_not raise_error
326
- expect{ uri.expanded_url }.to_not raise_error
327
- expect{ uri.display_url }.to_not raise_error
323
+ expect { uri.url }.not_to raise_error
324
+ expect { uri.expanded_url }.not_to raise_error
325
+ expect { uri.display_url }.not_to raise_error
328
326
  end
329
-
330
327
  end
331
328
 
332
- describe "#uri" do
333
- it "returns the URI to the tweet" do
334
- tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382, :screen_name => "sferik"})
329
+ describe '#uri' do
330
+ it 'returns the URI to the tweet' do
331
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :user => {:id => 7_505_382, :screen_name => 'sferik'})
335
332
  expect(tweet.uri).to be_a Addressable::URI
336
- expect(tweet.uri.to_s).to eq("https://twitter.com/sferik/status/28669546014")
333
+ expect(tweet.uri.to_s).to eq('https://twitter.com/sferik/status/28669546014')
337
334
  end
338
335
  end
339
336
 
340
- describe "#user" do
341
- it "returns a User when user is set" do
342
- tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382})
337
+ describe '#user' do
338
+ it 'returns a User when user is set' do
339
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :user => {:id => 7_505_382})
343
340
  expect(tweet.user).to be_a Twitter::User
344
341
  end
345
- it "returns nil when user is not set" do
346
- tweet = Twitter::Tweet.new(:id => 28669546014)
342
+ it 'returns nil when user is not set' do
343
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
347
344
  expect(tweet.user).to be_nil
348
345
  end
349
- it "has a status is set" do
350
- tweet = Twitter::Tweet.new(:id => 28669546014, :text => "Tweet text.", :user => {:id => 7505382})
346
+ it 'has a status is set' do
347
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :text => 'Tweet text.', :user => {:id => 7_505_382})
351
348
  expect(tweet.user.status).to be_a Twitter::Tweet
352
- expect(tweet.user.status.id).to eq 28669546014
349
+ expect(tweet.user.status.id).to eq 28_669_546_014
353
350
  end
354
351
  end
355
352
 
356
- describe "#user?" do
357
- it "returns true when status is set" do
358
- tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382})
353
+ describe '#user?' do
354
+ it 'returns true when status is set' do
355
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014, :user => {:id => 7_505_382})
359
356
  expect(tweet.user?).to be true
360
357
  end
361
- it "returns false when status is not set" do
362
- tweet = Twitter::Tweet.new(:id => 28669546014)
358
+ it 'returns false when status is not set' do
359
+ tweet = Twitter::Tweet.new(:id => 28_669_546_014)
363
360
  expect(tweet.user?).to be false
364
361
  end
365
362
  end
366
363
 
367
- describe "#user_mentions" do
368
- it "returns an array of Entity::UserMention when entities are set" do
364
+ describe '#user_mentions' do
365
+ it 'returns an array of Entity::UserMention when entities are set' do
369
366
  user_mentions_array = [
370
367
  {
371
- :screen_name => "sferik",
372
- :name => "Erik Michaels-Ober",
373
- :id_str => "7505382",
368
+ :screen_name => 'sferik',
369
+ :name => 'Erik Michaels-Ober',
370
+ :id_str => '7_505_382',
374
371
  :indices => [0, 6],
375
- :id => 7505382,
372
+ :id => 7_505_382,
376
373
  }
377
374
  ]
378
- user_mentions = Twitter::Tweet.new(:id => 28669546014, :entities => {:user_mentions => user_mentions_array}).user_mentions
375
+ user_mentions = Twitter::Tweet.new(:id => 28_669_546_014, :entities => {:user_mentions => user_mentions_array}).user_mentions
379
376
  expect(user_mentions).to be_an Array
380
377
  expect(user_mentions.first).to be_a Twitter::Entity::UserMention
381
378
  expect(user_mentions.first.indices).to eq([0, 6])
382
- expect(user_mentions.first.id).to eq(7505382)
379
+ expect(user_mentions.first.id).to eq(7_505_382)
383
380
  end
384
- it "is empty when not set" do
385
- user_mentions = Twitter::Tweet.new(:id => 28669546014).user_mentions
381
+ it 'is empty when not set' do
382
+ user_mentions = Twitter::Tweet.new(:id => 28_669_546_014).user_mentions
386
383
  expect(user_mentions).to be_empty
387
384
  end
388
- it "warns when not set" do
389
- Twitter::Tweet.new(:id => 28669546014).user_mentions
385
+ it 'warns when not set' do
386
+ Twitter::Tweet.new(:id => 28_669_546_014).user_mentions
390
387
  expect($stderr.string).to match(/To get user mentions, you must pass `:include_entities => true` when requesting the Twitter::Tweet\./)
391
388
  end
392
389
  end