Sha256: cf1e1274e6c2954869a9c7c8407745c246af3403f8153a3a1e2bfed85650de47

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

module Twitter
  class DirectMessage
    include EasyClassMaker
    
    attributes :id,
               :text,
               :sender_id,
               :recipient_id,
               :created_at,
               :sender_screen_name,
               :recipient_screen_name,
               :sender_profile_image_url
    
    class << self
      # Creates a new status from a piece of xml
      def new_from_xml(xml)
        DirectMessage.new do |d|
          d.id                    = (xml).at('id').innerHTML
          d.text                  = (xml).get_elements_by_tag_name('text').innerHTML
          d.sender_id             = (xml).at('sender_id').innerHTML
          d.recipient_id          = (xml).at('recipient_id').innerHTML
          d.created_at            = (xml).at('created_at').innerHTML
          d.sender_screen_name    = (xml).at('sender_screen_name').innerHTML
          d.recipient_screen_name = (xml).at('recipient_screen_name').innerHTML
          d.sender_profile_image_url = (xml).at('sender').at('profile_image_url').innerHTML
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
gilesbowkett-gilesbowkett-twitter-0.4.4 lib/twitter/direct_message.rb
gilesbowkett-twitter-0.4.3 lib/twitter/direct_message.rb
gilesbowkett-twitter-0.4.5 lib/twitter/direct_message.rb