Sha256: c9aa1938946aa5393e9bd732b29106ab7a9856eac9e5dbe1bc1aa698b36860db
Contents?: true
Size: 1.47 KB
Versions: 9
Compression:
Stored size: 1.47 KB
Contents
class Pupil # Returning direct messages # @param [Hash] param # @return [Hash] directmessages def dm(param = {}) param_s = param_serializer(param) begin response = @access_token.get("http://api.twitter.com/1/direct_messages.xml"+param_s) rescue return false end doc = REXML::Document.new(response.body) return false if doc.is_error? directmessages = Array.new doc.get_elements('/direct-messages/direct_message').each{|element| dm = DirectMessage.new(element) directmessages << dm } return directmessages end # Returning direct messages you sent # @param [Hash] param # @return [Hash] directmessage you sent def dm_sent(param = {}) param_s = param_serializer(param) begin response = @access_token.get("http://api.twitter.com/1/direct_messages/sent.xml"+param_s) rescue return false end doc = REXML::Document.new(response.body) return false if doc.is_error? directmessages = Array.new doc.get_elements('/direct-messages/direct_message').each{|element| dm = DirectMessage.new(element) directmessages << dm } return directmessages end # Delete direct message # @param [Fixnum] dm_id message id that you want to delete # @return [Hash] response def dm_destroy(dm_id) begin response = @access_token.post("http://api.twitter.com/1/direct_messages/destroy/#{dm_id}.xml") rescue return false end return response end end
Version data entries
9 entries across 9 versions & 1 rubygems