lib/twitter/api/direct_messages.rb in twitter-4.3.0 vs lib/twitter/api/direct_messages.rb in twitter-4.4.0
- old
+ new
@@ -90,11 +90,11 @@
#
# @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
# @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
# @param options [Hash] A customizable set of options.
def direct_messages(*args)
- options = args.extract_options!
+ options = extract_options!(args)
if args.empty?
direct_messages_received(options)
else
args.flatten.threaded_map do |id|
direct_message(id, options)
@@ -116,14 +116,11 @@
# Twitter.direct_message_destroy(1825785544)
# @overload direct_message_destroy(*ids, options)
# @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
# @param options [Hash] A customizable set of options.
def direct_message_destroy(*args)
- options = args.extract_options!
- args.flatten.threaded_map do |id|
- object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/destroy.json", options.merge(:id => id))
- end
+ threaded_object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/destroy.json", args)
end
# Sends a new direct message to the specified user from the authenticating user
#
# @see https://dev.twitter.com/docs/api/1.1/post/direct_messages/new
@@ -136,10 +133,10 @@
# @param options [Hash] A customizable set of options.
# @example Send a direct message to @sferik from the authenticating user
# Twitter.direct_message_create('sferik', "I'm sending you this message via @gem!")
# Twitter.direct_message_create(7505382, "I'm sending you this message via @gem!") # Same as above
def direct_message_create(user, text, options={})
- options.merge_user!(user)
+ merge_user!(options, user)
options[:text] = text
object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/new.json", options)
end
alias d direct_message_create
alias m direct_message_create