Permalink
Browse files

Prefer single-quoted strings when you don't need string interpolation…

… or special symbols
  • Loading branch information...
1 parent 4dda022 commit c2ed691ce152234d082743329bc50d21240ff713 @sferik committed Dec 8, 2013
Showing with 2,911 additions and 2,911 deletions.
  1. +2 −2 etc/erd.rb
  2. +4 −4 lib/twitter/base.rb
  3. +1 −1 lib/twitter/error/already_favorited.rb
  4. +1 −1 lib/twitter/error/already_posted.rb
  5. +1 −1 lib/twitter/error/already_retweeted.rb
  6. +2 −2 lib/twitter/null_object.rb
  7. +5 −5 lib/twitter/rest/api/direct_messages.rb
  8. +4 −4 lib/twitter/rest/api/favorites.rb
  9. +14 −14 lib/twitter/rest/api/friends_and_followers.rb
  10. +4 −4 lib/twitter/rest/api/help.rb
  11. +23 −23 lib/twitter/rest/api/lists.rb
  12. +2 −2 lib/twitter/rest/api/oauth.rb
  13. +3 −3 lib/twitter/rest/api/places_and_geo.rb
  14. +2 −2 lib/twitter/rest/api/saved_searches.rb
  15. +1 −1 lib/twitter/rest/api/search.rb
  16. +1 −1 lib/twitter/rest/api/spam_reporting.rb
  17. +1 −1 lib/twitter/rest/api/suggested_users.rb
  18. +4 −4 lib/twitter/rest/api/timelines.rb
  19. +3 −3 lib/twitter/rest/api/trends.rb
  20. +6 −6 lib/twitter/rest/api/tweets.rb
  21. +3 −3 lib/twitter/rest/api/undocumented.rb
  22. +20 −20 lib/twitter/rest/api/users.rb
  23. +11 −11 lib/twitter/rest/api/utils.rb
  24. +1 −1 lib/twitter/rest/client.rb
  25. +1 −1 lib/twitter/search_results.rb
  26. +1 −1 lib/twitter/streaming/client.rb
  27. +1 −1 lib/twitter/token.rb
  28. +1 −1 lib/twitter/tweet.rb
  29. +1 −1 lib/twitter/user.rb
  30. +1 −1 spec/helper.rb
  31. +8 −8 spec/twitter/base_spec.rb
  32. +6 −6 spec/twitter/basic_user_spec.rb
  33. +4 −4 spec/twitter/configuration_spec.rb
  34. +27 −27 spec/twitter/cursor_spec.rb
  35. +26 −26 spec/twitter/direct_message_spec.rb
  36. +27 −27 spec/twitter/entity/uri_spec.rb
  37. +21 −21 spec/twitter/error_spec.rb
  38. +9 −9 spec/twitter/geo/point_spec.rb
  39. +5 −5 spec/twitter/geo/polygon_spec.rb
  40. +6 −6 spec/twitter/geo_factory_spec.rb
  41. +9 −9 spec/twitter/geo_results_spec.rb
  42. +5 −5 spec/twitter/geo_spec.rb
  43. +8 −8 spec/twitter/identifiable_spec.rb
  44. +32 −32 spec/twitter/list_spec.rb
  45. +53 −53 spec/twitter/media/photo_spec.rb
  46. +4 −4 spec/twitter/media_factory_spec.rb
  47. +6 −6 spec/twitter/null_object_spec.rb
  48. +65 −65 spec/twitter/oembed_spec.rb
  49. +71 −71 spec/twitter/place_spec.rb
  50. +3 −3 spec/twitter/profile_banner_spec.rb
  51. +16 −16 spec/twitter/rate_limit_spec.rb
  52. +12 −12 spec/twitter/relationship_spec.rb
  53. +49 −49 spec/twitter/rest/api/direct_messages_spec.rb
  54. +79 −79 spec/twitter/rest/api/favorites_spec.rb
  55. +319 −319 spec/twitter/rest/api/friends_and_followers_spec.rb
  56. +33 −33 spec/twitter/rest/api/geo_spec.rb
  57. +24 −24 spec/twitter/rest/api/help_spec.rb
  58. +477 −477 spec/twitter/rest/api/lists_spec.rb
  59. +30 −30 spec/twitter/rest/api/oauth_spec.rb
  60. +34 −34 spec/twitter/rest/api/saved_searches_spec.rb
  61. +15 −15 spec/twitter/rest/api/search_spec.rb
  62. +8 −8 spec/twitter/rest/api/spam_reporting_spec.rb
  63. +23 −23 spec/twitter/rest/api/suggested_users_spec.rb
  64. +58 −58 spec/twitter/rest/api/timelines_spec.rb
  65. +24 −24 spec/twitter/rest/api/trends_spec.rb
  66. +244 −244 spec/twitter/rest/api/tweets_spec.rb
  67. +47 −47 spec/twitter/rest/api/undocumented_spec.rb
  68. +336 −336 spec/twitter/rest/api/users_spec.rb
  69. +97 −97 spec/twitter/rest/client_spec.rb
  70. +14 −14 spec/twitter/saved_search_spec.rb
  71. +37 −37 spec/twitter/search_results_spec.rb
  72. +8 −8 spec/twitter/settings_spec.rb
  73. +5 −5 spec/twitter/size_spec.rb
  74. +6 −6 spec/twitter/source_user_spec.rb
  75. +15 −15 spec/twitter/streaming/client_spec.rb
  76. +4 −4 spec/twitter/streaming/deleted_tweet_spec.rb
  77. +12 −12 spec/twitter/streaming/event_spec.rb
  78. +1 −1 spec/twitter/streaming/friend_list_spec.rb
  79. +10 −10 spec/twitter/streaming/message_parser_spec.rb
  80. +10 −10 spec/twitter/suggestion_spec.rb
  81. +6 −6 spec/twitter/target_user_spec.rb
  82. +4 −4 spec/twitter/token_spec.rb
  83. +28 −28 spec/twitter/trend_results_spec.rb
  84. +20 −20 spec/twitter/trend_spec.rb
  85. +125 −125 spec/twitter/tweet_spec.rb
  86. +161 −161 spec/twitter/user_spec.rb
View
@@ -5,7 +5,7 @@
COLON = ':'.freeze
UNDERSCORE = '_'.freeze
TAB = "\t".freeze
-NAMESPACE = "Twitter::".freeze
+NAMESPACE = 'Twitter::'.freeze
# Colons are invalid characters in DOT nodes.
# Replace them with underscores.
@@ -48,4 +48,4 @@ def puts(object, indent = 0, tab = TAB)
edges.sort.each do |child, parent|
puts "#{child} -> #{parent}", 1
end
-puts "}"
+puts '}'
View
@@ -47,10 +47,10 @@ def object_attr_reader(klass, key1, key2 = nil)
# @param attrs [Array, Symbol]
def uri_attr_reader(*attrs)
attrs.each do |uri_key|
- array = uri_key.to_s.split("_")
- index = array.index("uri")
- array[index] = "url"
- url_key = array.join("_").to_sym
+ array = uri_key.to_s.split('_')
+ index = array.index('uri')
+ array[index] = 'url'
+ url_key = array.join('_').to_sym
define_uri_method(uri_key, url_key)
alias_method(url_key, uri_key)
define_predicate_method(uri_key, url_key)
@@ -4,7 +4,7 @@ module Twitter
class Error
# Raised when a Tweet has already been favorited
class AlreadyFavorited < Twitter::Error::Forbidden
- MESSAGE = "You have already favorited this status"
+ MESSAGE = 'You have already favorited this status'
end
end
end
@@ -4,7 +4,7 @@ module Twitter
class Error
# Raised when a Tweet has already been posted
class AlreadyPosted < Twitter::Error::Forbidden
- MESSAGE = "Status is a duplicate"
+ MESSAGE = 'Status is a duplicate'
end
end
end
@@ -4,7 +4,7 @@ module Twitter
class Error
# Raised when a Tweet has already been retweeted
class AlreadyRetweeted < Twitter::Error::Forbidden
- MESSAGE = "sharing is not permissible for this status (Share validations failed)"
+ MESSAGE = 'sharing is not permissible for this status (Share validations failed)'
end
end
end
@@ -14,12 +14,12 @@ def method_missing(*args, &block)
# @return [TrueClass] This method always returns true.
def respond_to?(method_name, include_private = false)
true
- end if RUBY_VERSION < "1.9"
+ end if RUBY_VERSION < '1.9'
# @return [TrueClass] This method always returns true.
def respond_to_missing?(method_name, include_private = false)
true
- end if RUBY_VERSION >= "1.9"
+ end if RUBY_VERSION >= '1.9'
end
end
@@ -23,7 +23,7 @@ module DirectMessages
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
def direct_messages_received(options = {})
- objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages.json", options)
+ objects_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages.json', options)
end
# Returns the 20 most recent direct messages sent by the authenticating user
@@ -40,7 +40,7 @@ def direct_messages_received(options = {})
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
def direct_messages_sent(options = {})
- objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/sent.json", options)
+ objects_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages/sent.json', options)
end
# Returns a direct message
@@ -55,7 +55,7 @@ def direct_messages_sent(options = {})
# @param options [Hash] A customizable set of options.
def direct_message(id, options = {})
options[:id] = id
- object_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/show.json", options)
+ object_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages/show.json', options)
end
# @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
@@ -108,7 +108,7 @@ def direct_messages(*args)
# @param ids [Enumerable<Integer>] A collection of direct message IDs.
# @param options [Hash] A customizable set of options.
def destroy_direct_message(*args)
- threaded_objects_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/destroy.json", args)
+ threaded_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
end
deprecate_alias :direct_message_destroy, :destroy_direct_message
@@ -125,7 +125,7 @@ def destroy_direct_message(*args)
def create_direct_message(user, text, options = {})
merge_user!(options, user)
options[:text] = text
- object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/new.json", options)
+ object_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/new.json', options)
end
alias_method :d, :create_direct_message
alias_method :m, :create_direct_message
@@ -32,7 +32,7 @@ module Favorites
def favorites(*args)
arguments = Twitter::Arguments.new(args)
merge_user!(arguments.options, arguments.pop) if arguments.last
- objects_from_response(Twitter::Tweet, :get, "/1.1/favorites/list.json", arguments.options)
+ objects_from_response(Twitter::Tweet, :get, '/1.1/favorites/list.json', arguments.options)
end
# Un-favorites the specified Tweets as the authenticating user
@@ -48,7 +48,7 @@ def favorites(*args)
# @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def unfavorite(*args)
- threaded_objects_from_response(Twitter::Tweet, :post, "/1.1/favorites/destroy.json", args)
+ threaded_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
end
alias_method :destroy_favorite, :unfavorite
deprecate_alias :favorite_destroy, :unfavorite
@@ -70,7 +70,7 @@ def favorite(*args)
arguments.flatten.threaded_map do |tweet|
id = extract_id(tweet)
begin
- object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
+ object_from_response(Twitter::Tweet, :post, '/1.1/favorites/create.json', arguments.options.merge(:id => id))
rescue Twitter::Error::Forbidden => error
raise unless error.message == Twitter::Error::AlreadyFavorited::MESSAGE
end
@@ -98,7 +98,7 @@ def favorite!(*args)
arguments.flatten.threaded_map do |tweet|
id = extract_id(tweet)
begin
- object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
+ object_from_response(Twitter::Tweet, :post, '/1.1/favorites/create.json', arguments.options.merge(:id => id))
rescue Twitter::Error::Forbidden => error
handle_forbidden_error(Twitter::Error::AlreadyFavorited, error)
end
@@ -28,7 +28,7 @@ module FriendsAndFollowers
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
def friend_ids(*args)
- cursor_from_response_with_user(:ids, nil, :get, "/1.1/friends/ids.json", args)
+ cursor_from_response_with_user(:ids, nil, :get, '/1.1/friends/ids.json', args)
end
# @see https://dev.twitter.com/docs/api/1.1/get/followers/ids
@@ -48,7 +48,7 @@ def friend_ids(*args)
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
def follower_ids(*args)
- cursor_from_response_with_user(:ids, nil, :get, "/1.1/followers/ids.json", args)
+ cursor_from_response_with_user(:ids, nil, :get, '/1.1/followers/ids.json', args)
end
# Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none.
@@ -66,7 +66,7 @@ def follower_ids(*args)
def friendships(*args)
arguments = Twitter::Arguments.new(args)
merge_users!(arguments.options, arguments)
- objects_from_response(Twitter::User, :get, "/1.1/friendships/lookup.json", arguments.options)
+ objects_from_response(Twitter::User, :get, '/1.1/friendships/lookup.json', arguments.options)
end
# Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user
@@ -79,7 +79,7 @@ def friendships(*args)
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
def friendships_incoming(options = {})
- cursor_from_response(:ids, nil, :get, "/1.1/friendships/incoming.json", options)
+ cursor_from_response(:ids, nil, :get, '/1.1/friendships/incoming.json', options)
end
# Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
@@ -92,7 +92,7 @@ def friendships_incoming(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
def friendships_outgoing(options = {})
- cursor_from_response(:ids, nil, :get, "/1.1/friendships/outgoing.json", options)
+ cursor_from_response(:ids, nil, :get, '/1.1/friendships/outgoing.json', options)
end
# Allows the authenticating user to follow the specified users, unless they are already followed
@@ -138,7 +138,7 @@ def follow!(*args)
arguments = Twitter::Arguments.new(args)
arguments.flatten.threaded_map do |user|
begin
- object_from_response(Twitter::User, :post, "/1.1/friendships/create.json", merge_user(arguments.options, user))
+ object_from_response(Twitter::User, :post, '/1.1/friendships/create.json', merge_user(arguments.options, user))
rescue Twitter::Error::Forbidden
# This error will be raised if the user doesn't have permission to
# follow list_member, for whatever reason.
@@ -161,7 +161,7 @@ def follow!(*args)
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def unfollow(*args)
- threaded_user_objects_from_response(:post, "/1.1/friendships/destroy.json", args)
+ threaded_user_objects_from_response(:post, '/1.1/friendships/destroy.json', args)
end
alias_method :destroy_friendship, :unfollow
deprecate_alias :friendship_destroy, :unfollow
@@ -179,7 +179,7 @@ def unfollow(*args)
# @option options [Boolean] :retweets Enable/disable retweets from the target user.
def friendship_update(user, options = {})
merge_user!(options, user)
- object_from_response(Twitter::Relationship, :post, "/1.1/friendships/update.json", options)
+ object_from_response(Twitter::Relationship, :post, '/1.1/friendships/update.json', options)
end
# Returns detailed information about the relationship between two users
@@ -193,11 +193,11 @@ def friendship_update(user, options = {})
# @param target [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the target user.
# @param options [Hash] A customizable set of options.
def friendship(source, target, options = {})
- merge_user!(options, source, "source")
+ merge_user!(options, source, 'source')
options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil?
- merge_user!(options, target, "target")
+ merge_user!(options, target, 'target')
options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil?
- object_from_response(Twitter::Relationship, :get, "/1.1/friendships/show.json", options)
+ object_from_response(Twitter::Relationship, :get, '/1.1/friendships/show.json', options)
end
alias_method :friendship_show, :friendship
alias_method :relationship, :friendship
@@ -239,7 +239,7 @@ def friendship?(source, target, options = {})
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
def followers(*args)
- cursor_from_response_with_user(:users, Twitter::User, :get, "/1.1/followers/list.json", args)
+ cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/followers/list.json', args)
end
# Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
@@ -265,7 +265,7 @@ def followers(*args)
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
def friends(*args)
- cursor_from_response_with_user(:users, Twitter::User, :get, "/1.1/friends/list.json", args)
+ cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/friends/list.json', args)
end
alias_method :following, :friends
@@ -277,7 +277,7 @@ def friends(*args)
# @return [Array<Integer>]
# @param options [Hash] A customizable set of options.
def no_retweet_ids(options = {})
- get("/1.1/friendships/no_retweets/ids.json", options)[:body].map(&:to_i)
+ get('/1.1/friendships/no_retweets/ids.json', options)[:body].map(&:to_i)
end
alias_method :no_retweets_ids, :no_retweet_ids
@@ -16,7 +16,7 @@ module Help
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Configuration] Twitter's configuration.
def configuration(options = {})
- object_from_response(Twitter::Configuration, :get, "/1.1/help/configuration.json", options)
+ object_from_response(Twitter::Configuration, :get, '/1.1/help/configuration.json', options)
end
# Returns the list of languages supported by Twitter
@@ -27,7 +27,7 @@ def configuration(options = {})
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::Language>]
def languages(options = {})
- objects_from_response(Twitter::Language, :get, "/1.1/help/languages.json", options)
+ objects_from_response(Twitter::Language, :get, '/1.1/help/languages.json', options)
end
# Returns {https://twitter.com/privacy Twitter's Privacy Policy}
@@ -38,7 +38,7 @@ def languages(options = {})
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
def privacy(options = {})
- get("/1.1/help/privacy.json", options)[:body][:privacy]
+ get('/1.1/help/privacy.json', options)[:body][:privacy]
end
# Returns {https://twitter.com/tos Twitter's Terms of Service}
@@ -49,7 +49,7 @@ def privacy(options = {})
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
def tos(options = {})
- get("/1.1/help/tos.json", options)[:body][:tos]
+ get('/1.1/help/tos.json', options)[:body][:tos]
end
end
Oops, something went wrong.

0 comments on commit c2ed691

Please sign in to comment.