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
@@ -1,13 +1,6 @@
1
1
  module Twitter
2
2
  module Streaming
3
- class FriendList
4
-
5
- attr_reader :friend_ids
6
-
7
- # @param friend_ids [Array]
8
- def initialize(friend_ids)
9
- @friend_ids = friend_ids
10
- end
3
+ class FriendList < Array
11
4
  end
12
5
  end
13
- end
6
+ end
@@ -1,8 +1,14 @@
1
+ require 'twitter/direct_message'
2
+ require 'twitter/streaming/deleted_tweet'
3
+ require 'twitter/streaming/event'
4
+ require 'twitter/streaming/friend_list'
5
+ require 'twitter/streaming/stall_warning'
6
+ require 'twitter/tweet'
7
+
1
8
  module Twitter
2
9
  module Streaming
3
10
  class MessageParser
4
-
5
- def self.parse(data)
11
+ def self.parse(data) # rubocop:disable CyclomaticComplexity
6
12
  if data[:id]
7
13
  Tweet.new(data)
8
14
  elsif data[:event]
@@ -11,12 +17,12 @@ module Twitter
11
17
  DirectMessage.new(data[:direct_message])
12
18
  elsif data[:friends]
13
19
  FriendList.new(data[:friends])
14
- elsif data[:delete]
15
- if data[:delete][:status]
16
- Tweet.new(data[:delete][:status].merge(:deleted => true))
17
- end
20
+ elsif data[:delete] && data[:delete][:status]
21
+ DeletedTweet.new(data[:delete][:status])
22
+ elsif data[:warning]
23
+ StallWarning.new(data[:warning])
18
24
  end
19
25
  end
20
26
  end
21
27
  end
22
- end
28
+ end
@@ -3,7 +3,6 @@ require 'buftok'
3
3
  module Twitter
4
4
  module Streaming
5
5
  class Response
6
-
7
6
  # Initializes a new Response object
8
7
  #
9
8
  # @return [Twitter::Streaming::Response]
@@ -28,7 +27,6 @@ module Twitter
28
27
  @block.call(JSON.parse(line, :symbolize_names => true))
29
28
  end
30
29
  end
31
-
32
30
  end
33
31
  end
34
32
  end
@@ -0,0 +1,7 @@
1
+ module Twitter
2
+ module Streaming
3
+ class StallWarning < Twitter::Base
4
+ attr_reader :code, :message, :percent_full
5
+ end
6
+ end
7
+ end
@@ -13,6 +13,5 @@ module Twitter
13
13
  end
14
14
  end
15
15
  memoize :users
16
-
17
16
  end
18
17
  end
@@ -3,15 +3,14 @@ require 'twitter/base'
3
3
  module Twitter
4
4
  class Token < Twitter::Base
5
5
  attr_reader :access_token, :token_type
6
- alias to_s access_token
6
+ alias_method :to_s, :access_token
7
7
 
8
- BEARER_TYPE = "bearer"
8
+ BEARER_TYPE = 'bearer'
9
9
 
10
10
  # @return [Boolean]
11
11
  def bearer?
12
12
  @attrs[:token_type] == BEARER_TYPE
13
13
  end
14
14
  memoize :bearer?
15
-
16
15
  end
17
16
  end
@@ -9,27 +9,25 @@ module Twitter
9
9
  include Twitter::Enumerable
10
10
  include Memoizable
11
11
  attr_reader :attrs
12
- alias to_h attrs
13
- alias to_hash attrs
14
- alias to_hsh attrs
12
+ alias_method :to_h, :attrs
13
+ alias_method :to_hash, :attrs
14
+ alias_method :to_hsh, :attrs
15
15
 
16
16
  class << self
17
-
18
17
  # Construct a new TrendResults object from a response hash
19
18
  #
20
19
  # @param response [Hash]
21
20
  # @return [Twitter::Base]
22
- def from_response(response={})
21
+ def from_response(response = {})
23
22
  new(response[:body].first)
24
23
  end
25
-
26
24
  end
27
25
 
28
26
  # Initializes a new TrendResults object
29
27
  #
30
28
  # @param attrs [Hash]
31
29
  # @return [Twitter::TrendResults]
32
- def initialize(attrs={})
30
+ def initialize(attrs = {})
33
31
  @attrs = attrs
34
32
  @collection = Array(@attrs[:trends]).map do |trend|
35
33
  Trend.new(trend)
@@ -60,6 +58,5 @@ module Twitter
60
58
  !@attrs[:locations].nil? && !@attrs[:locations].first.nil?
61
59
  end
62
60
  memoize :location?
63
-
64
61
  end
65
62
  end
@@ -4,39 +4,33 @@ module Twitter
4
4
  class Tweet < Twitter::Identity
5
5
  include Twitter::Creatable
6
6
  attr_reader :favorite_count, :favorited, :in_reply_to_screen_name,
7
- :in_reply_to_attrs_id, :in_reply_to_status_id, :in_reply_to_user_id,
8
- :lang, :retweet_count, :retweeted, :source, :text, :truncated
9
- alias favorites_count favorite_count
10
- alias favoriters_count favorite_count
11
- alias in_reply_to_tweet_id in_reply_to_status_id
12
- alias retweeters_count retweet_count
13
- attr_reader :deleted
7
+ :in_reply_to_attrs_id, :in_reply_to_status_id,
8
+ :in_reply_to_user_id, :lang, :retweet_count, :retweeted,
9
+ :source, :text, :truncated
10
+ alias_method :favorites_count, :favorite_count
11
+ alias_method :favoriters_count, :favorite_count
12
+ alias_method :in_reply_to_tweet_id, :in_reply_to_status_id
13
+ alias_method :retweeters_count, :retweet_count
14
14
  object_attr_reader :GeoFactory, :geo
15
15
  object_attr_reader :Metadata, :metadata
16
16
  object_attr_reader :Place, :place
17
17
  object_attr_reader :Tweet, :retweeted_status
18
- alias retweet retweeted_status
19
- alias retweeted_tweet retweeted_status
20
- alias retweet? retweeted_status?
21
- alias retweeted_tweet? retweeted_status?
18
+ alias_method :retweet, :retweeted_status
19
+ alias_method :retweeted_tweet, :retweeted_status
20
+ alias_method :retweet?, :retweeted_status?
21
+ alias_method :retweeted_tweet?, :retweeted_status?
22
22
  object_attr_reader :User, :user, :status
23
23
 
24
24
  # @return [Boolean]
25
25
  def entities?
26
- !@attrs[:entities].nil? && @attrs[:entities].any?{|_, array| !array.empty?}
26
+ !@attrs[:entities].nil? && @attrs[:entities].any? { |_, array| !array.empty? }
27
27
  end
28
28
  memoize :entities?
29
29
 
30
30
  def filter_level
31
- @attrs[:filter_level] || "none"
31
+ @attrs[:filter_level] || 'none'
32
32
  end
33
33
  memoize :filter_level
34
-
35
- # @note Not a real entity
36
- # @return [Boolean]
37
- def deleted?
38
- deleted == true
39
- end
40
34
 
41
35
  # @return [String]
42
36
  # @note May be > 140 characters.
@@ -82,7 +76,7 @@ module Twitter
82
76
  Addressable::URI.parse("https://twitter.com/#{user.screen_name}/status/#{id}")
83
77
  end
84
78
  memoize :uri
85
- alias url uri
79
+ alias_method :url, :uri
86
80
 
87
81
  # @note Must include entities in your request for this method to work
88
82
  # @return [Array<Twitter::Entity::URI>]
@@ -90,7 +84,7 @@ module Twitter
90
84
  entities(Entity::URI, :urls)
91
85
  end
92
86
  memoize :uris
93
- alias urls uris
87
+ alias_method :urls, :uris
94
88
 
95
89
  # @note Must include entities in your request for this method to work
96
90
  # @return [Array<Twitter::Entity::UserMention>]
@@ -113,8 +107,6 @@ module Twitter
113
107
  []
114
108
  end
115
109
  end
116
-
117
110
  end
118
-
119
- Status = Tweet
111
+ Status = Tweet # rubocop:disable ConstantName
120
112
  end
@@ -7,32 +7,32 @@ module Twitter
7
7
  PREDICATE_URI_METHOD_REGEX = /_uri\?$/
8
8
  include Twitter::Creatable
9
9
  attr_reader :connections, :contributors_enabled, :default_profile,
10
- :default_profile_image, :description, :favourites_count,
11
- :follow_request_sent, :followers_count, :friends_count, :geo_enabled,
12
- :is_translator, :lang, :listed_count, :location, :name, :notifications,
13
- :profile_background_color, :profile_background_image_url,
14
- :profile_background_image_url_https, :profile_background_tile,
15
- :profile_link_color, :profile_sidebar_border_color,
16
- :profile_sidebar_fill_color, :profile_text_color,
17
- :profile_use_background_image, :protected, :statuses_count, :time_zone,
18
- :utc_offset, :verified
19
- alias favorites_count favourites_count
10
+ :default_profile_image, :description, :favourites_count,
11
+ :follow_request_sent, :followers_count, :friends_count,
12
+ :geo_enabled, :is_translator, :lang, :listed_count, :location,
13
+ :name, :notifications, :profile_background_color,
14
+ :profile_background_image_url,
15
+ :profile_background_image_url_https, :profile_background_tile,
16
+ :profile_link_color, :profile_sidebar_border_color,
17
+ :profile_sidebar_fill_color, :profile_text_color,
18
+ :profile_use_background_image, :protected, :statuses_count,
19
+ :time_zone, :utc_offset, :verified
20
+ alias_method :favorites_count, :favourites_count
20
21
  remove_method :favourites_count
21
- alias profile_background_image_uri profile_background_image_url
22
- alias profile_background_image_uri_https profile_background_image_url_https
23
- alias translator? is_translator
24
- alias tweets_count statuses_count
22
+ alias_method :profile_background_image_uri, :profile_background_image_url
23
+ alias_method :profile_background_image_uri_https, :profile_background_image_url_https
24
+ alias_method :translator?, :is_translator
25
+ alias_method :tweets_count, :statuses_count
25
26
  object_attr_reader :Tweet, :status, :user
26
- alias tweet status
27
- alias tweet? status?
28
- alias tweeted? status?
27
+ alias_method :tweet, :status
28
+ alias_method :tweet?, :status?
29
+ alias_method :tweeted?, :status?
29
30
 
30
31
  class << self
31
-
32
32
  private
33
33
 
34
34
  def alias_predicate_uri_methods(method)
35
- for replacement in %w(_url? _uri_https? _url_https?)
35
+ %w(_url? _uri_https? _url_https?).each do |replacement|
36
36
  alias_method_sub(method, PREDICATE_URI_METHOD_REGEX, replacement)
37
37
  end
38
38
  end
@@ -40,7 +40,6 @@ module Twitter
40
40
  def alias_method_sub(method, pattern, replacement)
41
41
  alias_method(method.to_s.sub(pattern, replacement).to_sym, method)
42
42
  end
43
-
44
43
  end
45
44
 
46
45
  # @return [Array<Twitter::Entity::URI>]
@@ -50,25 +49,25 @@ module Twitter
50
49
  end
51
50
  end
52
51
  memoize :description_uris
53
- alias description_urls description_uris
52
+ alias_method :description_urls, :description_uris
54
53
 
55
54
  # Return the URL to the user's profile banner image
56
55
  #
57
56
  # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
58
57
  # @return [String]
59
- def profile_banner_uri(size=:web)
58
+ def profile_banner_uri(size = :web)
60
59
  parse_encoded_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) if @attrs[:profile_banner_url]
61
60
  end
62
- alias profile_banner_url profile_banner_uri
61
+ alias_method :profile_banner_url, :profile_banner_uri
63
62
 
64
63
  # Return the secure URL to the user's profile banner image
65
64
  #
66
65
  # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
67
66
  # @return [String]
68
- def profile_banner_uri_https(size=:web)
67
+ def profile_banner_uri_https(size = :web)
69
68
  parse_encoded_uri([@attrs[:profile_banner_url], size].join('/')) if @attrs[:profile_banner_url]
70
69
  end
71
- alias profile_banner_url_https profile_banner_uri_https
70
+ alias_method :profile_banner_url_https, :profile_banner_uri_https
72
71
 
73
72
  # @return [Boolean]
74
73
  def profile_banner_uri?
@@ -81,16 +80,16 @@ module Twitter
81
80
  #
82
81
  # @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
83
82
  # @return [String]
84
- def profile_image_uri(size=:normal)
83
+ def profile_image_uri(size = :normal)
85
84
  parse_encoded_uri(insecure_uri(profile_image_uri_https(size))) if @attrs[:profile_image_url_https]
86
85
  end
87
- alias profile_image_url profile_image_uri
86
+ alias_method :profile_image_url, :profile_image_uri
88
87
 
89
88
  # Return the secure URL to the user's profile image
90
89
  #
91
90
  # @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
92
91
  # @return [String]
93
- def profile_image_uri_https(size=:normal)
92
+ def profile_image_uri_https(size = :normal)
94
93
  # The profile image URL comes in looking like like this:
95
94
  # https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png
96
95
  # It can be converted to any of the following sizes:
@@ -99,7 +98,7 @@ module Twitter
99
98
  # https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png
100
99
  parse_encoded_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) if @attrs[:profile_image_url_https]
101
100
  end
102
- alias profile_image_url_https profile_image_uri_https
101
+ alias_method :profile_image_url_https, :profile_image_uri_https
103
102
 
104
103
  def profile_image_uri?
105
104
  !!@attrs[:profile_image_url_https]
@@ -112,7 +111,7 @@ module Twitter
112
111
  Addressable::URI.parse("https://twitter.com/#{screen_name}")
113
112
  end
114
113
  memoize :uri
115
- alias url uri
114
+ alias_method :url, :uri
116
115
 
117
116
  # @return [String] The URL to the user's website.
118
117
  def website
@@ -136,8 +135,7 @@ module Twitter
136
135
  end
137
136
 
138
137
  def profile_image_suffix(size)
139
- :original == size.to_sym ? "\\1" : "_#{size}\\1"
138
+ :original == size.to_sym ? '\\1' : "_#{size}\\1"
140
139
  end
141
-
142
140
  end
143
141
  end
@@ -1,18 +1,15 @@
1
1
  module Twitter
2
2
  class Version
3
3
  MAJOR = 5
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  class << self
9
-
10
9
  # @return [String]
11
10
  def to_s
12
11
  [MAJOR, MINOR, PATCH, PRE].compact.join('.')
13
12
  end
14
-
15
13
  end
16
-
17
14
  end
18
15
  end
@@ -1,5 +1,6 @@
1
1
  {"friends":[488736931,311444249]}
2
2
  {"created_at":"Wed Apr 06 19:13:37 +0000 2011","id":55709764298092545,"id_str":"55709764298092545","text":"The problem with your code is that it's doing exactly what you told it to do.","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":7505382,"id_str":"7505382","name":"Erik Michaels-Ober","screen_name":"sferik","location":"San Francisco","description":"Write code. Not too much. Mostly Ruby.","url":"https:\/\/github.com\/sferik","entities":{"url":{"urls":[{"url":"https:\/\/github.com\/sferik","expanded_url":null,"indices":[0,25]}]},"description":{"urls":[]}},"protected":false,"followers_count":2479,"friends_count":200,"listed_count":132,"created_at":"Mon Jul 16 12:59:01 +0000 2007","favourites_count":4421,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":8730,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_banner_url":"https:\/\/si0.twimg.com\/profile_banners\/7505382\/1349499693","profile_link_color":"0084B4","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":{"type":"Point","coordinates":[37.78349999,-122.39362884]},"coordinates":{"type":"Point","coordinates":[-122.39362884,37.78349999]},"place":{"id":"5c92ab5379de3839","url":"https:\/\/api.twitter.com\/1.1\/geo\/id\/5c92ab5379de3839.json","place_type":"neighborhood","name":"South Beach","full_name":"South Beach, San Francisco","country_code":"US","country":"United States","bounding_box":{"type":"Polygon","coordinates":[[[-122.403482,37.777529],[-122.387436,37.777529],[-122.387436,37.794486],[-122.403482,37.794486]]]},"attributes":{}},"contributors":null,"retweet_count":316,"entities":{"hashtags":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false}
3
- {"created_at":"Wed Apr 06 19:13:37 +0000 2011","id":55709764298092545,"id_str":"55709764298092545","text":"The problem with your code is that it's doing exactly what you told it to do.","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":7505382,"id_str":"7505382","name":"Erik Michaels-Ober","screen_name":"sferik","location":"San Francisco","description":"Write code. Not too much. Mostly Ruby.","url":"https:\/\/github.com\/sferik","entities":{"url":{"urls":[{"url":"https:\/\/github.com\/sferik","expanded_url":null,"indices":[0,25]}]},"description":{"urls":[]}},"protected":false,"followers_count":2479,"friends_count":200,"listed_count":132,"created_at":"Mon Jul 16 12:59:01 +0000 2007","favourites_count":4421,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":8730,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/677717672\/bb0b3653dcf0644e344823e0a2eb3382.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","profile_banner_url":"https:\/\/si0.twimg.com\/profile_banners\/7505382\/1349499693","profile_link_color":"0084B4","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":{"type":"Point","coordinates":[37.78349999,-122.39362884]},"coordinates":{"type":"Point","coordinates":[-122.39362884,37.78349999]},"place":{"id":"5c92ab5379de3839","url":"https:\/\/api.twitter.com\/1.1\/geo\/id\/5c92ab5379de3839.json","place_type":"neighborhood","name":"South Beach","full_name":"South Beach, San Francisco","country_code":"US","country":"United States","bounding_box":{"type":"Polygon","coordinates":[[[-122.403482,37.777529],[-122.387436,37.777529],[-122.387436,37.794486],[-122.403482,37.794486]]]},"attributes":{}},"contributors":null,"retweet_count":316,"entities":{"hashtags":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false}
4
3
  {"direct_message":{"id":389327745617891328,"id_str":"389327745617891328","text":"hello bot","sender":{"id":10083602,"id_str":"10083602","name":"Adam Bird","screen_name":"adambird","location":"Nottingham, UK","url":"http:\/\/about.me\/adambird", "description":"CEO @onediaryapp, ex @esendex CTO and co-founder, still cycling","protected":false,"followers_count":1286,"friends_count":850,"listed_count":51,"created_at":"Fri Nov 09 00:35:12 +0000 2007","favourites_count":93,"utc_offset":3600,"time_zone":"London","geo_enabled":true,"verified":false,"statuses_count":13480,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/378800000477232297\/23d85bb78f71534eea1e1133fb771f86_normal.jpeg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/378800000477232297\/23d85bb78f71534eea1e1133fb771f86_normal.jpeg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"sender_id":10083602,"sender_id_str":"10083602","sender_screen_name":"adambird","recipient":{"id":1292911088,"id_str":"1292911088","name":"One Diary Bot","screen_name":"onediarybot","location":"","url":"http:\/\/www.onediary.com","description":"I'm the One Diary bot, here to help you with your life including personal cycling weather forecasts.","protected":false,"followers_count":113,"friends_count":148,"listed_count":1,"created_at":"Sat Mar 23 23:52:18 +0000 2013","favourites_count":0,"utc_offset":"","time_zone":"","geo_enabled":false,"verified":false,"statuses_count":7919,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/3651575369\/090551d8dd92080198f707769239ff43_normal.jpeg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/3651575369\/090551d8dd92080198f707769239ff43_normal.jpeg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"recipient_id":1292911088,"recipient_id_str":"1292911088","recipient_screen_name":"onediarybot","created_at":"Sun Oct 13 09:52:22 +0000 2013","entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]}}}
5
4
  {"event":"follow","source":{"id":10083602,"id_str":"10083602","name":"Adam Bird","screen_name":"adambird","location":"Nottingham, UK","url":"http://t.co/M1eaIKDQyz","description":"CEO @onediaryapp, ex @esendex CTO and co-founder, still cycling","protected":false,"followers_count":1295,"friends_count":850,"listed_count":53,"created_at":"Fri Nov 09 00:35:12 +0000 2007","favourites_count":93,"utc_offset":0,"time_zone":"London","geo_enabled":true,"verified":false,"statuses_count":13507,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","profile_background_tile":false,"profile_image_url":"http://pbs.twimg.com/profile_images/378800000477232297/23d85bb78f71534eea1e1133fb771f86_normal.jpeg","profile_image_url_https":"https://pbs.twimg.com/profile_images/378800000477232297/23d85bb78f71534eea1e1133fb771f86_normal.jpeg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"target":{"id":1292911088,"id_str":"1292911088","name":"One Diary Bot","screen_name":"onediarybot","location":null,"url":"http://t.co/etHGc0xHX4","description":"I'm the One Diary bot, here to help you with your life including personal cycling weather forecasts.","protected":false,"followers_count":123,"friends_count":157,"listed_count":1,"created_at":"Sat Mar 23 23:52:18 +0000 2013","favourites_count":0,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":9637,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","profile_background_tile":false,"profile_image_url":"http://pbs.twimg.com/profile_images/3651575369/090551d8dd92080198f707769239ff43_normal.jpeg","profile_image_url_https":"https://pbs.twimg.com/profile_images/3651575369/090551d8dd92080198f707769239ff43_normal.jpeg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"created_at":"Sun Oct 27 20:35:25 +0000 2013"}
5
+ {"delete":{"status":{"id":272691609211117568,"user_id":478569062,"id_str":"272691609211117568","user_id_str":"478569062","deleted":true}}}
6
+ {"warning":{"code":"FALLING_BEHIND","message":"Your connection is falling behind and messages are being queued for delivery to you. Your queue is now over 60% full. You will be disconnected when the queue is full.","percent_full":60}}
@@ -5,7 +5,11 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
5
  SimpleCov::Formatter::HTMLFormatter,
6
6
  Coveralls::SimpleCov::Formatter
7
7
  ]
8
- SimpleCov.start
8
+
9
+ SimpleCov.start do
10
+ add_filter '/spec/'
11
+ minimum_coverage(99.07)
12
+ end
9
13
 
10
14
  require 'twitter'
11
15
  require 'rspec'
@@ -55,7 +59,7 @@ def stub_put(path)
55
59
  end
56
60
 
57
61
  def fixture_path
58
- File.expand_path("../fixtures", __FILE__)
62
+ File.expand_path('../fixtures', __FILE__)
59
63
  end
60
64
 
61
65
  def fixture(file)
@@ -5,22 +5,22 @@ describe Twitter::Base do
5
5
  @base = Twitter::Base.new(:id => 1)
6
6
  end
7
7
 
8
- describe "#[]" do
9
- it "calls methods using [] with symbol" do
8
+ describe '#[]' do
9
+ it 'calls methods using [] with symbol' do
10
10
  expect(@base[:object_id]).to be_an Integer
11
11
  end
12
- it "calls methods using [] with string" do
13
- expect(@base["object_id"]).to be_an Integer
12
+ it 'calls methods using [] with string' do
13
+ expect(@base['object_id']).to be_an Integer
14
14
  end
15
- it "returns nil for missing method" do
15
+ it 'returns nil for missing method' do
16
16
  expect(@base[:foo]).to be_nil
17
- expect(@base["foo"]).to be_nil
17
+ expect(@base['foo']).to be_nil
18
18
  end
19
19
  end
20
20
 
21
- describe "#attrs" do
22
- it "returns a hash of attributes" do
23
- expect(@base.attrs).to eq({:id => 1})
21
+ describe '#attrs' do
22
+ it 'returns a hash of attributes' do
23
+ expect(@base.attrs).to eq(:id => 1)
24
24
  end
25
25
  end
26
26
 
@@ -2,18 +2,18 @@ require 'helper'
2
2
 
3
3
  describe Twitter::BasicUser do
4
4
 
5
- describe "#==" do
6
- it "returns true when objects IDs are the same" do
7
- saved_search = Twitter::BasicUser.new(:id => 1, :name => "foo")
8
- other = Twitter::BasicUser.new(:id => 1, :name => "bar")
5
+ describe '#==' do
6
+ it 'returns true when objects IDs are the same' do
7
+ saved_search = Twitter::BasicUser.new(:id => 1, :name => 'foo')
8
+ other = Twitter::BasicUser.new(:id => 1, :name => 'bar')
9
9
  expect(saved_search == other).to be true
10
10
  end
11
- it "returns false when objects IDs are different" do
11
+ it 'returns false when objects IDs are different' do
12
12
  saved_search = Twitter::BasicUser.new(:id => 1)
13
13
  other = Twitter::BasicUser.new(:id => 2)
14
14
  expect(saved_search == other).to be false
15
15
  end
16
- it "returns false when classes are different" do
16
+ it 'returns false when classes are different' do
17
17
  saved_search = Twitter::BasicUser.new(:id => 1)
18
18
  other = Twitter::Identity.new(:id => 1)
19
19
  expect(saved_search == other).to be false