Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add surrounding space in default value assignment

  • Loading branch information...
commit ce6ac07cf8d422400d7533ef8925ab118ac45b99 1 parent c4c43cd
@sferik authored
Showing with 158 additions and 158 deletions.
  1. +6 −6 lib/twitter/base.rb
  2. +2 −2 lib/twitter/client.rb
  3. +1 −1  lib/twitter/enumerable.rb
  4. +2 −2 lib/twitter/error.rb
  5. +1 −1  lib/twitter/factory.rb
  6. +1 −1  lib/twitter/geo_factory.rb
  7. +2 −2 lib/twitter/geo_results.rb
  8. +1 −1  lib/twitter/identity.rb
  9. +1 −1  lib/twitter/media_factory.rb
  10. +2 −2 lib/twitter/null_object.rb
  11. +1 −1  lib/twitter/relationship.rb
  12. +5 −5 lib/twitter/rest/api/direct_messages.rb
  13. +14 −14 lib/twitter/rest/api/friends_and_followers.rb
  14. +4 −4 lib/twitter/rest/api/help.rb
  15. +37 −37 lib/twitter/rest/api/lists.rb
  16. +4 −4 lib/twitter/rest/api/places_and_geo.rb
  17. +3 −3 lib/twitter/rest/api/saved_searches.rb
  18. +1 −1  lib/twitter/rest/api/search.rb
  19. +3 −3 lib/twitter/rest/api/suggested_users.rb
  20. +8 −8 lib/twitter/rest/api/timelines.rb
  21. +3 −3 lib/twitter/rest/api/trends.rb
  22. +7 −7 lib/twitter/rest/api/tweets.rb
  23. +3 −3 lib/twitter/rest/api/undocumented.rb
  24. +22 −22 lib/twitter/rest/api/users.rb
  25. +5 −5 lib/twitter/rest/api/utils.rb
  26. +6 −6 lib/twitter/rest/client.rb
  27. +2 −2 lib/twitter/search_results.rb
  28. +5 −5 lib/twitter/streaming/client.rb
  29. +2 −2 lib/twitter/trend_results.rb
  30. +4 −4 lib/twitter/user.rb
View
12 lib/twitter/base.rb
@@ -18,7 +18,7 @@ class << self
#
# @param response [Hash]
# @return [Twitter::Base]
- def from_response(response={})
+ def from_response(response = {})
new(response[:body])
end
@@ -37,7 +37,7 @@ def attr_reader(*attrs)
# @param klass [Symbol]
# @param key1 [Symbol]
# @param key2 [Symbol]
- def object_attr_reader(klass, key1, key2=nil)
+ def object_attr_reader(klass, key1, key2 = nil)
define_attribute_method(key1, klass, key2)
define_predicate_method(key1)
end
@@ -84,7 +84,7 @@ def define_uri_method(key1, key2)
# @param key1 [Symbol]
# @param klass [Symbol]
# @param key2 [Symbol]
- def define_attribute_method(key1, klass=nil, key2=nil)
+ def define_attribute_method(key1, klass = nil, key2 = nil)
define_method(key1) do ||
if klass.nil?
@attrs[key1]
@@ -104,7 +104,7 @@ def define_attribute_method(key1, klass=nil, key2=nil)
#
# @param key1 [Symbol]
# @param key2 [Symbol]
- def define_predicate_method(key1, key2=key1)
+ def define_predicate_method(key1, key2 = key1)
define_method(:"#{key1}?") do ||
!!@attrs[key2]
end
@@ -117,7 +117,7 @@ def define_predicate_method(key1, key2=key1)
#
# @param attrs [Hash]
# @return [Twitter::Base]
- def initialize(attrs={})
+ def initialize(attrs = {})
@attrs = attrs || {}
end
@@ -132,7 +132,7 @@ def [](method)
private
- def attrs_for_object(key1, key2=nil)
+ def attrs_for_object(key1, key2 = nil)
if key2.nil?
@attrs[key1]
else
View
4 lib/twitter/client.rb
@@ -14,7 +14,7 @@ class Client
#
# @param options [Hash]
# @return [Twitter::Client]
- def initialize(options={})
+ def initialize(options = {})
options.each do |key, value|
send(:"#{key}=", value)
end
@@ -61,7 +61,7 @@ def validate_credential_type!
end
end
- def oauth_auth_header(method, uri, params={})
+ def oauth_auth_header(method, uri, params = {})
uri = Addressable::URI.parse(uri)
SimpleOAuth::Header.new(method, uri, params, credentials)
end
View
2  lib/twitter/enumerable.rb
@@ -3,7 +3,7 @@ module Enumerable
include ::Enumerable
# @return [Enumerator]
- def each(start=0, &block)
+ def each(start = 0, &block)
return to_enum(:each) unless block_given?
Array(@collection[start..-1]).each do |element|
yield element
View
4 lib/twitter/error.rb
@@ -33,7 +33,7 @@ class << self
#
# @param response [Hash]
# @return [Twitter::Error]
- def from_response(response={})
+ def from_response(response = {})
error, code = parse_error(response[:body])
new(error, response[:response_headers], code)
end
@@ -75,7 +75,7 @@ def extract_message_from_errors(body)
# @param response_headers [Hash]
# @param code [Integer]
# @return [Twitter::Error]
- def initialize(exception=$!, response_headers={}, code=nil)
+ def initialize(exception = $!, response_headers = {}, code = nil)
@rate_limit = RateLimit.new(response_headers)
@wrapped_exception = exception
@code = code
View
2  lib/twitter/factory.rb
@@ -10,7 +10,7 @@ class << self
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a key.
# @return [Twitter::Base]
- def new(method, klass, attrs={})
+ def new(method, klass, attrs = {})
type = attrs.fetch(method.to_sym)
const_name = type.gsub(/\/(.?)/){"::#{$1.upcase}"}.gsub(/(?:^|_)(.)/){$1.upcase}
klass.const_get(const_name.to_sym).new(attrs)
View
2  lib/twitter/geo_factory.rb
@@ -12,7 +12,7 @@ class << self
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
# @return [Twitter::Geo]
- def new(attrs={})
+ def new(attrs = {})
super(:type, Geo, attrs)
end
View
4 lib/twitter/geo_results.rb
@@ -14,7 +14,7 @@ class << self
#
# @param response [Hash]
# @return [Twitter::Base]
- def from_response(response={})
+ def from_response(response = {})
new(response[:body])
end
@@ -24,7 +24,7 @@ def from_response(response={})
#
# @param attrs [Hash]
# @return [Twitter::GeoResults]
- def initialize(attrs={})
+ def initialize(attrs = {})
@attrs = attrs
@collection = Array(@attrs[:result][:places]).map do |place|
Place.new(place)
View
2  lib/twitter/identity.rb
@@ -11,7 +11,7 @@ class Identity < Twitter::Base
# @param attrs [Hash]
# @raise [ArgumentError] Error raised when supplied argument is missing an :id key.
# @return [Twitter::Identity]
- def initialize(attrs={})
+ def initialize(attrs = {})
attrs.fetch(:id)
super
end
View
2  lib/twitter/media_factory.rb
@@ -11,7 +11,7 @@ class << self
# @param attrs [Hash]
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
# @return [Twitter::Media]
- def new(attrs={})
+ def new(attrs = {})
super(:type, Media, attrs)
end
View
4 lib/twitter/null_object.rb
@@ -12,12 +12,12 @@ def method_missing(*args, &block)
end
# @return [TrueClass] This method always returns true.
- def respond_to?(method_name, include_private=false)
+ def respond_to?(method_name, include_private = false)
true
end if RUBY_VERSION < "1.9"
# @return [TrueClass] This method always returns true.
- def respond_to_missing?(method_name, include_private=false)
+ def respond_to_missing?(method_name, include_private = false)
true
end if RUBY_VERSION >= "1.9"
View
2  lib/twitter/relationship.rb
@@ -9,7 +9,7 @@ class Relationship < Twitter::Base
#
# @param attrs [Hash]
# @return [Twitter::Relationship]
- def initialize(attrs={})
+ def initialize(attrs = {})
@attrs = attrs[:relationship]
end
View
10 lib/twitter/rest/api/direct_messages.rb
@@ -22,7 +22,7 @@ module DirectMessages
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @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={})
+ def direct_messages_received(options = {})
objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages.json", options)
end
@@ -39,7 +39,7 @@ def direct_messages_received(options={})
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @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={})
+ def direct_messages_sent(options = {})
objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/sent.json", options)
end
@@ -53,7 +53,7 @@ def direct_messages_sent(options={})
# @return [Twitter::DirectMessage] The requested messages.
# @param id [Integer] A direct message ID.
# @param options [Hash] A customizable set of options.
- def direct_message(id, options={})
+ def direct_message(id, options = {})
options[:id] = id
object_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/show.json", options)
end
@@ -63,7 +63,7 @@ def direct_message(id, options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::DirectMessage>] The requested messages.
- # @overload direct_messages(options={})
+ # @overload direct_messages(options = {})
# Returns the 20 most recent direct messages sent to the authenticating user
#
# @see https://dev.twitter.com/docs/api/1.1/get/direct_messages
@@ -122,7 +122,7 @@ def destroy_direct_message(*args)
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param text [String] The text of your direct message, up to 140 characters.
# @param options [Hash] A customizable set of options.
- def create_direct_message(user, text, options={})
+ 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)
View
28 lib/twitter/rest/api/friends_and_followers.rb
@@ -16,12 +16,12 @@ module FriendsAndFollowers
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload friend_ids(options={})
+ # @overload friend_ids(options = {})
# Returns an array of numeric IDs for every user the authenticated user is following
#
# @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.
- # @overload friend_ids(user, options={})
+ # @overload friend_ids(user, options = {})
# Returns an array of numeric IDs for every user the specified user is following
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -36,12 +36,12 @@ def friend_ids(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload follower_ids(options={})
+ # @overload follower_ids(options = {})
# Returns an array of numeric IDs for every user following the authenticated user
#
# @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.
- # @overload follower_ids(user, options={})
+ # @overload follower_ids(user, options = {})
# Returns an array of numeric IDs for every user following the specified user
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -78,7 +78,7 @@ def friendships(*args)
# @return [Twitter::Cursor]
# @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={})
+ def friendships_incoming(options = {})
cursor_from_response(:ids, nil, :get, "/1.1/friendships/incoming.json", options)
end
@@ -91,7 +91,7 @@ def friendships_incoming(options={})
# @return [Twitter::Cursor]
# @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={})
+ def friendships_outgoing(options = {})
cursor_from_response(:ids, nil, :get, "/1.1/friendships/outgoing.json", options)
end
@@ -177,7 +177,7 @@ def unfollow(*args)
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :device Enable/disable device notifications from the target user.
# @option options [Boolean] :retweets Enable/disable retweets from the target user.
- def friendship_update(user, options={})
+ def friendship_update(user, options = {})
merge_user!(options, user)
object_from_response(Twitter::Relationship, :post, "/1.1/friendships/update.json", options)
end
@@ -192,7 +192,7 @@ def friendship_update(user, options={})
# @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
# @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={})
+ def friendship(source, target, options = {})
merge_user!(options, source, "source")
options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil?
merge_user!(options, target, "target")
@@ -212,7 +212,7 @@ def friendship(source, target, options={})
# @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
# @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={})
+ def friendship?(source, target, options = {})
friendship(source, target, options).source.following?
end
@@ -223,14 +223,14 @@ def friendship?(source, target, options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload followers(options={})
+ # @overload followers(options = {})
# Returns a cursored collection of user objects for users following the authenticated user.
#
# @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.
# @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.
- # @overload followers(user, options={})
+ # @overload followers(user, options = {})
# Returns a cursored collection of user objects for users following the specified user.
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -249,14 +249,14 @@ def followers(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload friends(options={})
+ # @overload friends(options = {})
# Returns a cursored collection of user objects for every user the authenticated user is following (otherwise known as their "friends").
#
# @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.
# @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.
- # @overload friends(user, options={})
+ # @overload friends(user, options = {})
# Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -276,7 +276,7 @@ def friends(*args)
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Integer>]
# @param options [Hash] A customizable set of options.
- def no_retweet_ids(options={})
+ def no_retweet_ids(options = {})
get("/1.1/friendships/no_retweets/ids.json", options)[:body].map(&:to_i)
end
alias no_retweets_ids no_retweet_ids
View
8 lib/twitter/rest/api/help.rb
@@ -15,7 +15,7 @@ module Help
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Configuration] Twitter's configuration.
- def configuration(options={})
+ def configuration(options = {})
object_from_response(Twitter::Configuration, :get, "/1.1/help/configuration.json", options)
end
@@ -26,7 +26,7 @@ def configuration(options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::Language>]
- def languages(options={})
+ def languages(options = {})
objects_from_response(Twitter::Language, :get, "/1.1/help/languages.json", options)
end
@@ -37,7 +37,7 @@ def languages(options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
- def privacy(options={})
+ def privacy(options = {})
get("/1.1/help/privacy.json", options)[:body][:privacy]
end
@@ -48,7 +48,7 @@ def privacy(options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [String]
- def tos(options={})
+ def tos(options = {})
get("/1.1/help/tos.json", options)[:body][:tos]
end
View
74 lib/twitter/rest/api/lists.rb
@@ -23,10 +23,10 @@ module Lists
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::List>]
- # @overload lists(options={})
+ # @overload lists(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
- # @overload lists(user, options={})
+ # @overload lists(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
@@ -42,13 +42,13 @@ def lists(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::Tweet>]
- # @overload list_timeline(list, options={})
+ # @overload list_timeline(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count The number of results to retrieve.
- # @overload list_timeline(user, list, options={})
+ # @overload list_timeline(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -69,11 +69,11 @@ def list_timeline(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
- # @overload remove_list_member(list, user_to_remove, options={})
+ # @overload remove_list_member(list, user_to_remove, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
# @param options [Hash] A customizable set of options.
- # @overload remove_list_member(user, list, user_to_remove, options={})
+ # @overload remove_list_member(user, list, user_to_remove, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
@@ -90,11 +90,11 @@ def remove_list_member(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload memberships(options={})
+ # @overload memberships(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.
# @option options [Boolean, String, Integer] :filter_to_owned_lists When set to true, t or 1, will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.
- # @overload memberships(user, options={})
+ # @overload memberships(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @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.
@@ -110,11 +110,11 @@ def memberships(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor] The subscribers of the specified list.
- # @overload list_subscribers(list, options={})
+ # @overload list_subscribers(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @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.
- # @overload list_subscribers(user, list, options={})
+ # @overload list_subscribers(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -130,10 +130,10 @@ def list_subscribers(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
- # @overload list_subscribe(list, options={})
+ # @overload list_subscribe(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
- # @overload list_subscribe(user, list, options={})
+ # @overload list_subscribe(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -148,11 +148,11 @@ def list_subscribe(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
- # @overload list_subscriber?(list, user_to_check, options={})
+ # @overload list_subscriber?(list, user_to_check, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
- # @overload list_subscriber?(user, list, user_to_check, options={})
+ # @overload list_subscriber?(user, list, user_to_check, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -169,10 +169,10 @@ def list_subscriber?(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
- # @overload list_unsubscribe(list, options={})
+ # @overload list_unsubscribe(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
- # @overload list_unsubscribe(user, list, options={})
+ # @overload list_unsubscribe(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -188,11 +188,11 @@ def list_unsubscribe(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
- # @overload add_list_members(list, users, options={})
+ # @overload add_list_members(list, users, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @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.
- # @overload add_list_members(user, list, users, options={})
+ # @overload add_list_members(user, list, users, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
@@ -209,11 +209,11 @@ def add_list_members(*args)
# @rate_limited Yes
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if user is a member of the specified list, otherwise false.
- # @overload list_member?(list, user_to_check, options={})
+ # @overload list_member?(list, user_to_check, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String] The user ID or screen name of the list member.
# @param options [Hash] A customizable set of options.
- # @overload list_member?(user, list, user_to_check, options={})
+ # @overload list_member?(user, list, user_to_check, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_check [Integer, String] The user ID or screen name of the list member.
@@ -229,11 +229,11 @@ def list_member?(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload list_members(list, options={})
+ # @overload list_members(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @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.
- # @overload list_members(user, list, options={})
+ # @overload list_members(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -250,11 +250,11 @@ def list_members(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
- # @overload add_list_member(list, user_to_add, options={})
+ # @overload add_list_member(list, user_to_add, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
# @param options [Hash] A customizable set of options.
- # @overload add_list_member(user, list, user_to_add, options={})
+ # @overload add_list_member(user, list, user_to_add, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
@@ -272,10 +272,10 @@ def add_list_member(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The deleted list.
- # @overload destroy_list(list, options={})
+ # @overload destroy_list(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
- # @overload destroy_list(user, list, options={})
+ # @overload destroy_list(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -291,12 +291,12 @@ def destroy_list(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The created list.
- # @overload list_update(list, options={})
+ # @overload list_update(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
# @option options [String] :description The description to give the list.
- # @overload list_update(user, list, options={})
+ # @overload list_update(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -318,7 +318,7 @@ def list_update(*args)
# @param options [Hash] A customizable set of options.
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
# @option options [String] :description The description to give the list.
- def create_list(name, options={})
+ def create_list(name, options = {})
object_from_response(Twitter::List, :post, "/1.1/lists/create.json", options.merge(:name => name))
end
deprecate_alias :list_create, :create_list
@@ -331,10 +331,10 @@ def create_list(name, options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The specified list.
- # @overload list(list, options={})
+ # @overload list(list, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
- # @overload list(user, list, options={})
+ # @overload list(user, list, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param options [Hash] A customizable set of options.
@@ -349,10 +349,10 @@ def list(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor]
- # @overload subscriptions(options={})
+ # @overload subscriptions(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.
- # @overload subscriptions(user, options={})
+ # @overload subscriptions(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @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.
@@ -367,11 +367,11 @@ def subscriptions(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::List] The list.
- # @overload remove_list_members(list, users, options={})
+ # @overload remove_list_members(list, users, options = {})
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @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.
- # @overload remove_list_members(user, list, users, options={})
+ # @overload remove_list_members(user, list, users, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
@@ -388,10 +388,10 @@ def remove_list_members(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::List>]
- # @overload owned_lists(options={})
+ # @overload owned_lists(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
- # @overload owned_lists(user, options={})
+ # @overload owned_lists(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
View
8 lib/twitter/rest/api/places_and_geo.rb
@@ -17,7 +17,7 @@ module PlacesAndGeo
# @param place_id [String] A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
# @param options [Hash] A customizable set of options.
# @return [Twitter::Place] The requested place.
- def place(place_id, options={})
+ def place(place_id, options = {})
object_from_response(Twitter::Place, :get, "/1.1/geo/id/#{place_id}.json", options)
end
@@ -35,7 +35,7 @@ def place(place_id, options={})
# @option options [String] :granularity ('neighborhood') This is the minimal granularity of place types to return and must be one of: 'poi', 'neighborhood', 'city', 'admin' or 'country'.
# @option options [Integer] :max_results A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
# @return [Array<Twitter::Place>]
- def reverse_geocode(options={})
+ def reverse_geocode(options = {})
object_from_response(Twitter::GeoResults, :get, "/1.1/geo/reverse_geocode.json", options)
end
@@ -56,7 +56,7 @@ def reverse_geocode(options={})
# @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
# @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
# @return [Array<Twitter::Place>]
- def geo_search(options={})
+ def geo_search(options = {})
object_from_response(Twitter::GeoResults, :get, "/1.1/geo/search.json", options)
end
alias places_nearby geo_search
@@ -75,7 +75,7 @@ def geo_search(options={})
# @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
# @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
# @return [Array<Twitter::Place>]
- def similar_places(options={})
+ def similar_places(options = {})
object_from_response(Twitter::GeoResults, :get, "/1.1/geo/similar_places.json", options)
end
alias places_similar similar_places
View
6 lib/twitter/rest/api/saved_searches.rb
@@ -12,7 +12,7 @@ module SavedSearches
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::SavedSearch>] The saved searches.
- # @overload saved_search(options={})
+ # @overload saved_search(options = {})
# Returns the authenticated user's saved search queries
#
# @see https://dev.twitter.com/docs/api/1.1/get/saved_searches/list
@@ -48,7 +48,7 @@ def saved_searches(*args)
# @return [Twitter::SavedSearch] The saved searches.
# @param id [Integer] The ID of the saved search.
# @param options [Hash] A customizable set of options.
- def saved_search(id, options={})
+ def saved_search(id, options = {})
object_from_response(Twitter::SavedSearch, :get, "/1.1/saved_searches/show/#{id}.json", options)
end
@@ -61,7 +61,7 @@ def saved_search(id, options={})
# @return [Twitter::SavedSearch] The created saved search.
# @param query [String] The query of the search the user would like to save.
# @param options [Hash] A customizable set of options.
- def create_saved_search(query, options={})
+ def create_saved_search(query, options = {})
object_from_response(Twitter::SavedSearch, :post, "/1.1/saved_searches/create.json", options.merge(:query => query))
end
deprecate_alias :saved_search_create, :create_saved_search
View
2  lib/twitter/rest/api/search.rb
@@ -27,7 +27,7 @@ module Search
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
# @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
- def search(q, options={})
+ def search(q, options = {})
object_from_response(Twitter::SearchResults, :get, "/1.1/search/tweets.json", options.merge(:q => q))
end
View
6 lib/twitter/rest/api/suggested_users.rb
@@ -13,12 +13,12 @@ module SuggestedUsers
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
- # @overload suggestions(options={})
+ # @overload suggestions(options = {})
# Returns the list of suggested user categories
#
# @see https://dev.twitter.com/docs/api/1.1/get/users/suggestions
# @param options [Hash] A customizable set of options.
- # @overload suggestions(slug, options={})
+ # @overload suggestions(slug, options = {})
# Returns the users in a given category
#
# @see https://dev.twitter.com/docs/api/1.1/get/users/suggestions/:slug
@@ -41,7 +41,7 @@ def suggestions(*args)
# @param slug [String] The short name of list or a category.
# @param options [Hash] A customizable set of options.
# @return [Array<Twitter::User>]
- def suggest_users(slug, options={})
+ def suggest_users(slug, options = {})
objects_from_response(Twitter::User, :get, "/1.1/users/suggestions/#{slug}/members.json", options)
end
View
16 lib/twitter/rest/api/timelines.rb
@@ -23,7 +23,7 @@ module Timelines
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
- def mentions_timeline(options={})
+ def mentions_timeline(options = {})
objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/mentions_timeline.json", options)
end
alias mentions mentions_timeline
@@ -36,7 +36,7 @@ def mentions_timeline(options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::Tweet>]
- # @overload user_timeline(user, options={})
+ # @overload user_timeline(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
@@ -66,7 +66,7 @@ def user_timeline(*args)
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
- def retweeted_by_user(user, options={})
+ def retweeted_by_user(user, options = {})
retweets_from_timeline(options) do |opts|
user_timeline(user, opts)
end
@@ -88,7 +88,7 @@ def retweeted_by_user(user, options={})
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
- def retweeted_by_me(options={})
+ def retweeted_by_me(options = {})
retweets_from_timeline(options) do |opts|
user_timeline(opts)
end
@@ -111,7 +111,7 @@ def retweeted_by_me(options={})
# @option options [Boolean, String, Integer] :include_rts Specifies that the timeline should include native retweets in addition to regular tweets. Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will no longer contain a full user object.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
# @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
- def home_timeline(options={})
+ def home_timeline(options = {})
objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/home_timeline.json", options)
end
@@ -131,7 +131,7 @@ def home_timeline(options={})
# @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
# @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
- def retweeted_to_me(options={})
+ def retweeted_to_me(options = {})
retweets_from_timeline(options) do |opts|
home_timeline(opts)
end
@@ -151,7 +151,7 @@ def retweeted_to_me(options={})
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
- def retweets_of_me(options={})
+ def retweets_of_me(options = {})
objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/retweets_of_me.json", options)
end
@@ -189,7 +189,7 @@ def collect_with_count(count, &block)
# @param collection [Array]
# @param max_id [Integer, NilClass]
# @return [Array<Twitter::Tweet>]
- def collect_with_max_id(collection=[], max_id=nil, &block)
+ def collect_with_max_id(collection = [], max_id = nil, &block)
tweets = yield(max_id)
return collection if tweets.nil?
collection += tweets
View
6 lib/twitter/rest/api/trends.rb
@@ -18,7 +18,7 @@ module Trends
# @param options [Hash] A customizable set of options.
# @option options [String] :exclude Setting this equal to 'hashtags' will remove all hashtags from the trends list.
# @return [Array<Twitter::Trend>]
- def trends(id=1, options={})
+ def trends(id = 1, options = {})
options[:id] = id
object_from_response(Twitter::TrendResults, :get, "/1.1/trends/place.json", options)
end
@@ -33,7 +33,7 @@ def trends(id=1, options={})
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @return [Array<Twitter::Place>]
- def trends_available(options={})
+ def trends_available(options = {})
objects_from_response(Twitter::Place, :get, "/1.1/trends/available.json", options)
end
alias trend_locations trends_available
@@ -48,7 +48,7 @@ def trends_available(options={})
# @option options [Float] :lat If provided with a :long option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for latitude are -90.0 to +90.0 (North is positive) inclusive.
# @option options [Float] :long If provided with a :lat option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive.
# @return [Array<Twitter::Place>]
- def trends_closest(options={})
+ def trends_closest(options = {})
objects_from_response(Twitter::Place, :get, "/1.1/trends/closest.json", options)
end
View
14 lib/twitter/rest/api/tweets.rb
@@ -23,7 +23,7 @@ module Tweets
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
- def retweets(tweet, options={})
+ def retweets(tweet, options = {})
id = extract_id(tweet)
objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/retweets/#{id}.json", options)
end
@@ -40,7 +40,7 @@ def retweets(tweet, options={})
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
# @option options [Boolean] :ids_only ('false') Only return user ids instead of full user objects.
- def retweeters_of(tweet, options={})
+ def retweeters_of(tweet, options = {})
ids_only = !!options.delete(:ids_only)
retweeters = retweets(tweet, options).map(&:user)
ids_only ? retweeters.map(&:id) : retweeters
@@ -57,7 +57,7 @@ def retweeters_of(tweet, options={})
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
- def status(tweet, options={})
+ def status(tweet, options = {})
id = extract_id(tweet)
object_from_response(Twitter::Tweet, :get, "/1.1/statuses/show/#{id}.json", options)
end
@@ -118,7 +118,7 @@ def destroy_status(*args)
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
- def update(status, options={})
+ def update(status, options = {})
hash = options.dup
hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
@@ -198,7 +198,7 @@ def retweet!(*args)
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
- def update_with_media(status, media, options={})
+ def update_with_media(status, media, options = {})
hash = options.dup
hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
@@ -223,7 +223,7 @@ def update_with_media(status, media, options={})
# @option options [String] :align Specifies whether the embedded Tweet should be left aligned, right aligned, or centered in the page. Valid values are left, right, center, and none. Defaults to none, meaning no alignment styles are specified for the Tweet.
# @option options [String] :related A value for the TWT related parameter, as described in {https://dev.twitter.com/docs/intents Web Intents}. This value will be forwarded to all Web Intents calls.
# @option options [String] :lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.
- def oembed(tweet, options={})
+ def oembed(tweet, options = {})
options[:id] = extract_id(tweet)
object_from_response(Twitter::OEmbed, :get, "/1.1/statuses/oembed.json", options)
end
@@ -264,7 +264,7 @@ def oembeds(*args)
# @return [Twitter::Cursor]
# @overload retweeters_ids(options)
# @param options [Hash] A customizable set of options.
- # @overload retweeters_ids(id, options={})
+ # @overload retweeters_ids(id, options = {})
# @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
# @param options [Hash] A customizable set of options.
def retweeters_ids(*args)
View
6 lib/twitter/rest/api/undocumented.rb
@@ -15,14 +15,14 @@ module Undocumented
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
#
- # @overload following_followers_of(options={})
+ # @overload following_followers_of(options = {})
# Returns users following followers of the specified user
#
# @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.
# @return [Twitter::Cursor]
#
- # @overload following_followers_of(user, options={})
+ # @overload following_followers_of(user, options = {})
# Returns users following followers of the authenticated user
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -41,7 +41,7 @@ def following_followers_of(*args)
# @return [Integer]
# @param uri [String, URI] A URI.
# @param options [Hash] A customizable set of options.
- def tweet_count(uri, options={})
+ def tweet_count(uri, options = {})
connection = Faraday.new("https://cdn.api.twitter.com", connection_options.merge(:builder => middleware))
connection.get("/1/urls/count.json", options.merge(:url => uri.to_s)).body[:count]
end
View
44 lib/twitter/rest/api/users.rb
@@ -29,7 +29,7 @@ module Users
# @option options [Integer] :end_sleep_time The hour that sleep time should end if it is enabled. The value for this parameter should be provided in {http://en.wikipedia.org/wiki/ISO_8601 ISO8601} format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
# @option options [String] :time_zone The timezone dates and times should be displayed in for the user. The timezone must be one of the {http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html Rails TimeZone} names.
# @option options [String] :lang The language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by {https://dev.twitter.com/docs/api/1.1/get/help/languages GET help/languages}.
- def settings(options={})
+ def settings(options = {})
request_method = options.size.zero? ? :get : :post
response = send(request_method.to_sym, "/1.1/account/settings.json", options)
# https://dev.twitter.com/issues/59
@@ -46,7 +46,7 @@ def settings(options={})
# @return [Twitter::User] The authenticated user.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include user's Tweets when set to true, 't' or 1.
- def verify_credentials(options={})
+ def verify_credentials(options = {})
object_from_response(Twitter::User, :get, "/1.1/account/verify_credentials.json", options)
end
alias current_user verify_credentials
@@ -60,7 +60,7 @@ def verify_credentials(options={})
# @return [Twitter::User] The authenticated user.
# @param device [String] Must be one of: 'sms', 'none'.
# @param options [Hash] A customizable set of options.
- def update_delivery_device(device, options={})
+ def update_delivery_device(device, options = {})
object_from_response(Twitter::User, :post, "/1.1/account/update_delivery_device.json", options.merge(:device => device))
end
@@ -77,7 +77,7 @@ def update_delivery_device(device, options={})
# @option options [String] :url URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.
# @option options [String] :location The city or country describing where the user of the account is located. The contents are not normalized or geocoded in any way. Maximum of 30 characters.
# @option options [String] :description A description of the user owning the account. Maximum of 160 characters.
- def update_profile(options={})
+ def update_profile(options = {})
object_from_response(Twitter::User, :post, "/1.1/account/update_profile.json", options)
end
@@ -91,7 +91,7 @@ def update_profile(options={})
# @param image [File] The background image for the profile, base64-encoded. Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forcibly scaled down. The image must be provided as raw multipart data, not a URL.
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :tile Whether or not to tile the background image. If set to true the background image will be displayed tiled. The image will not be tiled otherwise.
- def update_profile_background_image(image, options={})
+ def update_profile_background_image(image, options = {})
object_from_response(Twitter::User, :post, "/1.1/account/update_profile_background_image.json", options.merge(:image => image))
end
@@ -108,7 +108,7 @@ def update_profile_background_image(image, options={})
# @option options [String] :profile_link_color Profile link color.
# @option options [String] :profile_sidebar_fill_color Profile sidebar's background color.
# @option options [String] :profile_sidebar_border_color Profile sidebar's border color.
- def update_profile_colors(options={})
+ def update_profile_colors(options = {})
object_from_response(Twitter::User, :post, "/1.1/account/update_profile_colors.json", options)
end
@@ -123,7 +123,7 @@ def update_profile_colors(options={})
# @return [Twitter::User] The authenticated user.
# @param image [File] The avatar image for the profile, base64-encoded. Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 500 pixels will be scaled down. Animated GIFs will be converted to a static GIF of the first frame, removing the animation.
# @param options [Hash] A customizable set of options.
- def update_profile_image(image, options={})
+ def update_profile_image(image, options = {})
object_from_response(Twitter::User, :post, "/1.1/account/update_profile_image.json", options.merge(:image => image))
end
@@ -136,7 +136,7 @@ def update_profile_image(image, options={})
# @return [Array<Twitter::User>] User objects that the authenticating user is blocking.
# @param options [Hash] A customizable set of options.
# @option options [Integer] :page Specifies the page of results to retrieve.
- def blocking(options={})
+ def blocking(options = {})
cursor_from_response(:users, Twitter::User, :get, "/1.1/blocks/list.json", options)
end
@@ -147,7 +147,7 @@ def blocking(options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::Cursor] Numeric user IDs the authenticating user is blocking.
- # @overload block(options={})
+ # @overload block(options = {})
# @param options [Hash] A customizable set of options.
def blocked_ids(*args)
arguments = Twitter::Arguments.new(args)
@@ -164,7 +164,7 @@ def blocked_ids(*args)
# @return [Boolean] true if the authenticating user is blocking the target user, otherwise false.
# @param user [Integer, String, URI, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
- def block?(user, options={})
+ def block?(user, options = {})
merge_default_cursor!(options)
user_id = case user
when Integer
@@ -237,13 +237,13 @@ def users(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::User] The requested user.
- # @overload user(options={})
+ # @overload user(options = {})
# Returns extended information for the authenticated user
#
# @param options [Hash] A customizable set of options.
# @option options [Boolean] :include_entities The tweet entities node will be disincluded when set to false.
# @option options [Boolean, String, Integer] :skip_status Do not include user's Tweets when set to true, 't' or 1.
- # @overload user(user, options={})
+ # @overload user(user, options = {})
# Returns extended information for a given user
#
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -267,7 +267,7 @@ def user(*args)
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Boolean] true if the user exists, otherwise false.
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
- def user?(user, options={})
+ def user?(user, options = {})
merge_user!(options, user)
get("/1.1/users/show.json", options)
true
@@ -286,7 +286,7 @@ def user?(user, options={})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The number of people to retrieve. Maxiumum of 20 allowed per page.
# @option options [Integer] :page Specifies the page of results to retrieve.
- def user_search(query, options={})
+ def user_search(query, options = {})
objects_from_response(Twitter::User, :get, "/1.1/users/search.json", options.merge(:q => query))
end
@@ -297,10 +297,10 @@ def user_search(query, options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::User>]
- # @overload contributees(options={})
+ # @overload contributees(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
- # @overload contributees(user, options={})
+ # @overload contributees(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
@@ -315,10 +315,10 @@ def contributees(*args)
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Array<Twitter::User>]
- # @overload contributors(options={})
+ # @overload contributors(options = {})
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
- # @overload contributors(user, options={})
+ # @overload contributors(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
@@ -334,7 +334,7 @@ def contributors(*args)
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [nil]
# @param options [Hash] A customizable set of options.
- def remove_profile_banner(options={})
+ def remove_profile_banner(options = {})
post("/1.1/account/remove_profile_banner.json", options)[:body]
end
deprecate_alias :profile_banner_remove, :remove_profile_banner
@@ -356,7 +356,7 @@ def remove_profile_banner(options={})
# @option options [Integer] :height The height of the preferred section of the image being uploaded in pixels. Use with width, offset_left, and offset_top to select the desired region of the image to use.
# @option options [Integer] :offset_left The number of pixels by which to offset the uploaded image from the left. Use with height, width, and offset_top to select the desired region of the image to use.
# @option options [Integer] :offset_top The number of pixels by which to offset the uploaded image from the top. Use with height, width, and offset_left to select the desired region of the image to use.
- def update_profile_banner(banner, options={})
+ def update_profile_banner(banner, options = {})
post("/1.1/account/update_profile_banner.json", options.merge(:banner => banner))[:body]
end
@@ -368,8 +368,8 @@ def update_profile_banner(banner, options={})
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Twitter::ProfileBanner]
- # @overload profile_banner(options={})
- # @overload profile_banner(user, options={})
+ # @overload profile_banner(options = {})
+ # @overload profile_banner(user, options = {})
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
def profile_banner(*args)
arguments = Twitter::Arguments.new(args)
View
10 lib/twitter/rest/api/utils.rb
@@ -87,7 +87,7 @@ def objects_from_response_with_user(klass, request_method, path, args)
# @param path [String]
# @param options [Hash]
# @return [Array]
- def objects_from_response(klass, request_method, path, options={})
+ def objects_from_response(klass, request_method, path, options = {})
response = send(request_method.to_sym, path, options)[:body]
objects_from_array(klass, response)
end
@@ -119,7 +119,7 @@ def threaded_objects_from_response(klass, request_method, path, args)
# @param path [String]
# @param options [Hash]
# @return [Object]
- def object_from_response(klass, request_method, path, options={})
+ def object_from_response(klass, request_method, path, options = {})
response = send(request_method.to_sym, path, options)
klass.from_response(response)
end
@@ -166,7 +166,7 @@ def screen_name
# @param hash [Hash]
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @return [Hash]
- def merge_user(hash, user, prefix=nil)
+ def merge_user(hash, user, prefix = nil)
merge_user!(hash.dup, user, prefix)
end
@@ -175,7 +175,7 @@ def merge_user(hash, user, prefix=nil)
# @param hash [Hash]
# @param user [Integer, String, URI, Twitter::User] A Twitter user ID, screen name, URI, or object.
# @return [Hash]
- def merge_user!(hash, user, prefix=nil)
+ def merge_user!(hash, user, prefix = nil)
case user
when Integer
set_compound_key("user_id", user, hash, prefix)
@@ -192,7 +192,7 @@ def merge_user!(hash, user, prefix=nil)
end
end
- def set_compound_key(key, value, hash, prefix=nil)
+ def set_compound_key(key, value, hash, prefix = nil)
compound_key = [prefix, key].compact.join("_").to_sym
hash[compound_key] = value
hash
View
12 lib/twitter/rest/client.rb
@@ -88,23 +88,23 @@ def middleware
end
# Perform an HTTP DELETE request
- def delete(path, params={})
+ def delete(path, params = {})
request(:delete, path, params)
end
# Perform an HTTP GET request
- def get(path, params={})
+ def get(path, params = {})
request(:get, path, params)
end
# Perform an HTTP POST request
- def post(path, params={})
+ def post(path, params = {})
signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params
request(:post, path, params, signature_params)
end
# Perform an HTTP PUT request
- def put(path, params={})
+ def put(path, params = {})
request(:put, path, params)
end
@@ -127,7 +127,7 @@ def connection
@connection ||= Faraday.new(ENDPOINT, connection_options)
end
- def request(method, path, params={}, signature_params=params)
+ def request(method, path, params = {}, signature_params = params)
response = connection.send(method.to_sym, path, params) do |request|
bearer_token_request = params.delete(:bearer_token_request)
if bearer_token_request
@@ -143,7 +143,7 @@ def request(method, path, params={}, signature_params=params)
raise Twitter::Error
end
- def auth_token(method, path, params={}, signature_params=params)
+ def auth_token(method, path, params = {}, signature_params = params)
if !user_token?
@bearer_token = token unless bearer_token?
bearer_auth_header
View
4 lib/twitter/search_results.rb
@@ -14,7 +14,7 @@ class << self
#
# @param response [Hash]
# @return [Twitter::Base]
- def from_response(response={})
+ def from_response(response = {})
new(response[:body])
end
@@ -24,7 +24,7 @@ def from_response(response={})
#
# @param attrs [Hash]
# @return [Twitter::SearchResults]
- def initialize(attrs={})
+ def initialize(attrs = {})
@attrs = attrs
@collection = Array(@attrs[:statuses]).map do |tweet|
Tweet.new(tweet)
View
10 lib/twitter/streaming/client.rb
@@ -13,7 +13,7 @@ class Client < Twitter::Client
# Initializes a new Client object
#
# @return [Twitter::Streaming::Client]
- def initialize(options={}, &block)
+ def initialize(options = {}, &block)
super
@connection = Streaming::Connection.new
end
@@ -28,7 +28,7 @@ def initialize(options={}, &block)
# @option options [String] :track Includes additional Tweets matching the specified keywords. Phrases of keywords are specified by a comma-separated list.
# @option options [String] :locations Includes additional Tweets falling within the specified bounding boxes.
# @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
- def filter(options={}, &block)
+ def filter(options = {}, &block)
request(:post, 'https://stream.twitter.com:443/1.1/statuses/filter.json', options, &block)
end
@@ -40,7 +40,7 @@ def filter(options={}, &block)
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The number of messages to backfill.
# @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
- def firehose(options={}, &block)
+ def firehose(options = {}, &block)
request(:get, 'https://stream.twitter.com:443/1.1/statuses/firehose.json', options, &block)
end
@@ -49,7 +49,7 @@ def firehose(options={}, &block)
# @see https://dev.twitter.com/docs/api/1.1/get/statuses/sample
# @see https://dev.twitter.com/docs/streaming-apis/parameters
# @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
- def sample(options={}, &block)
+ def sample(options = {}, &block)
request(:get, 'https://stream.twitter.com:443/1.1/statuses/sample.json', options, &block)
end
@@ -80,7 +80,7 @@ def site(*args, &block)
# @option options [String] :track Includes additional Tweets matching the specified keywords. Phrases of keywords are specified by a comma-separated list.
# @option options [String] :locations Includes additional Tweets falling within the specified bounding boxes.
# @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
- def user(options={}, &block)
+ def user(options = {}, &block)
request(:get, 'https://userstream.twitter.com:443/1.1/user.json', options, &block)
end
View
4 lib/twitter/trend_results.rb
@@ -19,7 +19,7 @@ class << self
#
# @param response [Hash]
# @return [Twitter::Base]
- def from_response(response={})
+ def from_response(response = {})
new(response[:body].first)
end
@@ -29,7 +29,7 @@ def from_response(response={})
#
# @param attrs [Hash]
# @return [Twitter::TrendResults]
- def initialize(attrs={})
+ def initialize(attrs = {})
@attrs = attrs
@collection = Array(@attrs[:trends]).map do |trend|
Trend.new(trend)
View
8 lib/twitter/user.rb
@@ -56,7 +56,7 @@ def description_uris
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
# @return [String]
- def profile_banner_uri(size=:web)
+ def profile_banner_uri(size = :web)
parse_encoded_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) if @attrs[:profile_banner_url]
end
alias profile_banner_url profile_banner_uri
@@ -65,7 +65,7 @@ def profile_banner_uri(size=:web)
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
# @return [String]
- def profile_banner_uri_https(size=:web)
+ def profile_banner_uri_https(size = :web)
parse_encoded_uri([@attrs[:profile_banner_url], size].join('/')) if @attrs[:profile_banner_url]
end
alias profile_banner_url_https profile_banner_uri_https
@@ -81,7 +81,7 @@ def profile_banner_uri?
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
# @return [String]
- def profile_image_uri(size=:normal)
+ def profile_image_uri(size = :normal)
parse_encoded_uri(insecure_uri(profile_image_uri_https(size))) if @attrs[:profile_image_url_https]
end
alias profile_image_url profile_image_uri
@@ -90,7 +90,7 @@ def profile_image_uri(size=:normal)
#
# @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
# @return [String]
- def profile_image_uri_https(size=:normal)
+ def profile_image_uri_https(size = :normal)
# The profile image URL comes in looking like like this:
# https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png
# It can be converted to any of the following sizes:
Please sign in to comment.
Something went wrong with that request. Please try again.