twitter_feed 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/twitter_feed.rb +25 -0
- metadata +65 -0
    
        data/lib/twitter_feed.rb
    ADDED
    
    | @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            require 'net/http'
         | 
| 2 | 
            +
            require 'rexml/document'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class Twitter
         | 
| 5 | 
            +
              FEED_URL="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name="
         | 
| 6 | 
            +
              @contenido
         | 
| 7 | 
            +
              @tweets
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
             def getContent(url) 
         | 
| 10 | 
            +
               uri = URI.parse(url)
         | 
| 11 | 
            +
               @contenido=Net::HTTP.get(uri)
         | 
| 12 | 
            +
             end 
         | 
| 13 | 
            +
             
         | 
| 14 | 
            +
             def getFeed(username)
         | 
| 15 | 
            +
              getContent(FEED_URL+username)
         | 
| 16 | 
            +
              doc = REXML::Document.new @contenido
         | 
| 17 | 
            +
              @tweets= Array.new
         | 
| 18 | 
            +
              doc.elements.each("statuses/status/text") { |element,index| 
         | 
| 19 | 
            +
                @tweets.push(element.text) 
         | 
| 20 | 
            +
                puts element.text
         | 
| 21 | 
            +
              }
         | 
| 22 | 
            +
              
         | 
| 23 | 
            +
             end
         | 
| 24 | 
            +
             
         | 
| 25 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: twitter_feed
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 23
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 1
         | 
| 8 | 
            +
              - 0
         | 
| 9 | 
            +
              - 0
         | 
| 10 | 
            +
              version: 1.0.0
         | 
| 11 | 
            +
            platform: ruby
         | 
| 12 | 
            +
            authors: 
         | 
| 13 | 
            +
            - Oscar Garcia
         | 
| 14 | 
            +
            autorequire: 
         | 
| 15 | 
            +
            bindir: bin
         | 
| 16 | 
            +
            cert_chain: []
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            date: 2012-11-11 00:00:00 Z
         | 
| 19 | 
            +
            dependencies: []
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            description: Obtiene los feeds de un usuario en Twitter
         | 
| 22 | 
            +
            email: oscar.garcia@elclubdelprogramador.com
         | 
| 23 | 
            +
            executables: []
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            extensions: []
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            extra_rdoc_files: []
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            files: 
         | 
| 30 | 
            +
            - lib/twitter_feed.rb
         | 
| 31 | 
            +
            homepage: http://elclubdelprogramador.com
         | 
| 32 | 
            +
            licenses: []
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            post_install_message: 
         | 
| 35 | 
            +
            rdoc_options: []
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            require_paths: 
         | 
| 38 | 
            +
            - lib
         | 
| 39 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 40 | 
            +
              none: false
         | 
| 41 | 
            +
              requirements: 
         | 
| 42 | 
            +
              - - ">="
         | 
| 43 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 44 | 
            +
                  hash: 3
         | 
| 45 | 
            +
                  segments: 
         | 
| 46 | 
            +
                  - 0
         | 
| 47 | 
            +
                  version: "0"
         | 
| 48 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 49 | 
            +
              none: false
         | 
| 50 | 
            +
              requirements: 
         | 
| 51 | 
            +
              - - ">="
         | 
| 52 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 53 | 
            +
                  hash: 3
         | 
| 54 | 
            +
                  segments: 
         | 
| 55 | 
            +
                  - 0
         | 
| 56 | 
            +
                  version: "0"
         | 
| 57 | 
            +
            requirements: []
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            rubyforge_project: 
         | 
| 60 | 
            +
            rubygems_version: 1.8.15
         | 
| 61 | 
            +
            signing_key: 
         | 
| 62 | 
            +
            specification_version: 3
         | 
| 63 | 
            +
            summary: Feeds de Twitter
         | 
| 64 | 
            +
            test_files: []
         | 
| 65 | 
            +
             |