pushpop-twitter 0.1.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/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +11 -0
- data/LICENSE +21 -0
- data/README.md +8 -0
- data/Rakefile +16 -0
- data/examples/jobs.rb +19 -0
- data/lib/pushpop-twitter.rb +56 -0
- data/lib/pushpop-twitter/version.rb +5 -0
- data/pushpop-twitter.gemspec +25 -0
- data/spec/fixtures/dzello.json +1 -0
- data/spec/fixtures/ids.json +1 -0
- data/spec/fixtures/status.json +1 -0
- data/spec/fixtures/users.json +1 -0
- data/spec/pushpop-twitter_spec.rb +57 -0
- data/spec/spec_helper.rb +13 -0
- metadata +131 -0
    
        data/.gitignore
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            Gemfile.lock
         | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            Author Josh Dzielak
         | 
| 2 | 
            +
            Copyright (c) 2014 Keen Labs
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 5 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 6 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 7 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 8 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 9 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 10 | 
            +
            the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 13 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 16 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 17 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 18 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 19 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 20 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 21 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            $stdout.sync = true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            $: << File.join(File.dirname(__FILE__), './lib')
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            begin
         | 
| 6 | 
            +
              require 'rspec/core/rake_task'
         | 
| 7 | 
            +
              desc 'Run Rspec unit tests'
         | 
| 8 | 
            +
              RSpec::Core::RakeTask.new(:spec) do |t|
         | 
| 9 | 
            +
                t.pattern = 'spec/**/*_spec.rb'
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              task default: :spec
         | 
| 13 | 
            +
            rescue LoadError
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
             | 
    
        data/examples/jobs.rb
    ADDED
    
    | @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # from this repository run with:
         | 
| 2 | 
            +
            # $ foreman run bundle exec ruby examples/jobs.rb
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'pushpop'
         | 
| 5 | 
            +
            require_relative '../lib/pushpop-twitter'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            job do
         | 
| 8 | 
            +
              twitter do
         | 
| 9 | 
            +
                follow 'dzello'
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
            end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            job do
         | 
| 14 | 
            +
              twitter do
         | 
| 15 | 
            +
                favorite({ :id_str => '484793990345023489' })
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            Pushpop.run
         | 
| @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            require 'pushpop'
         | 
| 2 | 
            +
            require 'twitter'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Pushpop
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              class Twitter < Step
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                PLUGIN_NAME = 'twitter'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                Pushpop::Job.register_plugin(PLUGIN_NAME, self)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def initialize(*args)
         | 
| 13 | 
            +
                  super
         | 
| 14 | 
            +
                  @twitter = ::Twitter::REST::Client.new do |config|
         | 
| 15 | 
            +
                    config.consumer_key        = ENV['TWITTER_CONSUMER_KEY']
         | 
| 16 | 
            +
                    config.consumer_secret     = ENV['TWITTER_CONSUMER_SECRET']
         | 
| 17 | 
            +
                    config.access_token        = ENV['TWITTER_OAUTH_TOKEN']
         | 
| 18 | 
            +
                    config.access_token_secret = ENV['TWITTER_OAUTH_SECRET']
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                def run(last_response=nil, step_responses=nil)
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  self.configure(last_response, step_responses)
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  case @command
         | 
| 27 | 
            +
                  when 'follow'
         | 
| 28 | 
            +
                    @twitter.follow @username
         | 
| 29 | 
            +
                  when 'favorite'
         | 
| 30 | 
            +
                    @twitter.favorite @tweet_id
         | 
| 31 | 
            +
                  else
         | 
| 32 | 
            +
                    raise 'No command specified!'
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                def follow(username, options={})
         | 
| 38 | 
            +
                  @command = 'follow'
         | 
| 39 | 
            +
                  @username = username
         | 
| 40 | 
            +
                  @options = options
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                # param tweet, tweet-sized JSON
         | 
| 44 | 
            +
                def favorite(tweet, options={})
         | 
| 45 | 
            +
                  @command = 'favorite'
         | 
| 46 | 
            +
                  @tweet_id = tweet[:id_str]
         | 
| 47 | 
            +
                  @options = options
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                def configure(last_response=nil, step_responses=nil)
         | 
| 51 | 
            +
                  self.instance_exec(last_response, step_responses, &block)
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 2 | 
            +
            $:.push File.expand_path("../lib", __FILE__)
         | 
| 3 | 
            +
            require 'pushpop-twitter/version'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Gem::Specification.new do |s|
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              s.name        = "pushpop-twitter"
         | 
| 8 | 
            +
              s.version     = Pushpop::Twitter::VERSION
         | 
| 9 | 
            +
              s.authors     = ["Josh Dzielak"]
         | 
| 10 | 
            +
              s.email       = "josh@keen.io"
         | 
| 11 | 
            +
              s.homepage    = "https://github.com/pushpop-project/pushpop-twitter"
         | 
| 12 | 
            +
              s.summary     = "A set of Pushpop capabilities for the Twitter API"
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              s.add_dependency "pushpop"
         | 
| 15 | 
            +
              s.add_dependency "twitter"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              s.add_development_dependency "rake"
         | 
| 18 | 
            +
              s.add_development_dependency "rspec"
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              s.files         = `git ls-files`.split("\n")
         | 
| 21 | 
            +
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 22 | 
            +
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 23 | 
            +
              s.require_paths = ["lib"]
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"id":45297280,"id_str":"45297280","name":"Josh Dzielak","screen_name":"dzello","location":"San Francisco","description":"VP Engineering @keen_io \u2013 Analytics for Developers \u00b7 Open Source Streaker #oss365","url":"http:\/\/t.co\/yB0PmqCSdw","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/yB0PmqCSdw","expanded_url":"http:\/\/github.com\/dzello","display_url":"github.com\/dzello","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":2500,"friends_count":765,"listed_count":90,"created_at":"Sun Jun 07 06:30:05 +0000 2009","favourites_count":62004,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":4058,"lang":"en","status":{"created_at":"Tue Jul 08 03:33:45 +0000 2014","id":486352410911068160,"id_str":"486352410911068160","text":"RT @fredsters_s: And so #365daysofopensource begins. Also, dis cool: https:\/\/t.co\/90w571wUz3 h\/t @dzello http:\/\/t.co\/By4vhR56rz","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Tue Jul 08 02:33:01 +0000 2014","id":486337127769075712,"id_str":"486337127769075712","text":"And so #365daysofopensource begins. Also, dis cool: https:\/\/t.co\/90w571wUz3 h\/t @dzello http:\/\/t.co\/By4vhR56rz","source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":2,"favorite_count":2,"entities":{"hashtags":[{"text":"365daysofopensource","indices":[7,27]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/90w571wUz3","expanded_url":"https:\/\/github.com\/jsonresume\/resume-schema","display_url":"github.com\/jsonresume\/res\u2026","indices":[52,75]}],"user_mentions":[{"screen_name":"dzello","name":"Josh Dzielak","id":45297280,"id_str":"45297280","indices":[80,87]}],"media":[{"id":486337126917607424,"id_str":"486337126917607424","indices":[88,110],"media_url":"http:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","media_url_https":"https:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","url":"http:\/\/t.co\/By4vhR56rz","display_url":"pic.twitter.com\/By4vhR56rz","expanded_url":"http:\/\/twitter.com\/fredsters_s\/status\/486337127769075712\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":258,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":1023,"h":777,"resize":"fit"},"medium":{"w":599,"h":455,"resize":"fit"}}}]},"favorited":true,"retweeted":true,"possibly_sensitive":false,"lang":"en"},"retweet_count":2,"favorite_count":0,"entities":{"hashtags":[{"text":"365daysofopensource","indices":[24,44]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/90w571wUz3","expanded_url":"https:\/\/github.com\/jsonresume\/resume-schema","display_url":"github.com\/jsonresume\/res\u2026","indices":[69,92]}],"user_mentions":[{"screen_name":"fredsters_s","name":"Fred Stevens-Smith","id":14868289,"id_str":"14868289","indices":[3,15]},{"screen_name":"dzello","name":"Josh Dzielak","id":45297280,"id_str":"45297280","indices":[97,104]}],"media":[{"id":486337126917607424,"id_str":"486337126917607424","indices":[105,127],"media_url":"http:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","media_url_https":"https:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","url":"http:\/\/t.co\/By4vhR56rz","display_url":"pic.twitter.com\/By4vhR56rz","expanded_url":"http:\/\/twitter.com\/fredsters_s\/status\/486337127769075712\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":258,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":1023,"h":777,"resize":"fit"},"medium":{"w":599,"h":455,"resize":"fit"}},"source_status_id":486337127769075712,"source_status_id_str":"486337127769075712"}]},"favorited":true,"retweeted":true,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"E0C8AE","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/804712707\/94c825d263f85de25ea96f410d847ac6.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/804712707\/94c825d263f85de25ea96f410d847ac6.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/378800000663269534\/8980f07490a067d022bdc174a78792bb_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/378800000663269534\/8980f07490a067d022bdc174a78792bb_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/45297280\/1383442574","profile_link_color":"2C2630","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"654C52","profile_text_color":"5A454C","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"suspended":false,"needs_phone_verification":false}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"previous_cursor":0,"next_cursor_str":"0","ids":[20009713,22469930,351223419],"previous_cursor_str":"0","next_cursor":0}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"created_at":"Fri Mar 28 21:34:45 +0000 2014","id":449660889793581056,"id_str":"449660889793581056","text":"\"I hope you'll keep...building bonds of friendship that will enrich your lives & enrich our world\" \u2014FLOTUS in China, http:\/\/t.co\/fxmuQN9JL9","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1093090866,"id_str":"1093090866","name":"The First Lady","screen_name":"FLOTUS","location":"Washington, DC","description":"This account is run by the Office of First Lady Michelle Obama. Tweets from the First Lady are signed \u2013mo. Tweets may be archived. More at http:\/\/t.co\/9DxP65hB","url":"http:\/\/t.co\/RvRZspIO8c","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/RvRZspIO8c","expanded_url":"http:\/\/www.whitehouse.gov","display_url":"whitehouse.gov","indices":[0,22]}]},"description":{"urls":[{"url":"http:\/\/t.co\/9DxP65hB","expanded_url":"http:\/\/wh.gov\/privacy","display_url":"wh.gov\/privacy","indices":[139,159]}]}},"protected":false,"followers_count":875307,"friends_count":21,"listed_count":5338,"created_at":"Tue Jan 15 20:03:17 +0000 2013","favourites_count":0,"utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":false,"verified":true,"statuses_count":812,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"0084B4","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/766168824\/6d7e9bac6f5904ab0843bd1e9d935695.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/766168824\/6d7e9bac6f5904ab0843bd1e9d935695.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/453354757499781120\/WsSISQK__normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/453354757499781120\/WsSISQK__normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/1093090866\/1396923217","profile_link_color":"0084B4","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":222,"favorite_count":295,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[],"media":[{"id":449660809380380673,"id_str":"449660809380380673","indices":[121,143],"media_url":"http:\/\/pbs.twimg.com\/media\/Bj2EH6yIQAEYvxu.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Bj2EH6yIQAEYvxu.jpg","url":"http:\/\/t.co\/fxmuQN9JL9","display_url":"pic.twitter.com\/fxmuQN9JL9","expanded_url":"http:\/\/twitter.com\/FLOTUS\/status\/449660889793581056\/photo\/1","type":"photo","sizes":{"medium":{"w":600,"h":399,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":640,"h":426,"resize":"fit"},"small":{"w":340,"h":226,"resize":"fit"}}}]},"extended_entities":{"media":[{"id":449660809380380673,"id_str":"449660809380380673","indices":[121,143],"media_url":"http:\/\/pbs.twimg.com\/media\/Bj2EH6yIQAEYvxu.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Bj2EH6yIQAEYvxu.jpg","url":"http:\/\/t.co\/fxmuQN9JL9","display_url":"pic.twitter.com\/fxmuQN9JL9","expanded_url":"http:\/\/twitter.com\/FLOTUS\/status\/449660889793581056\/photo\/1","type":"photo","sizes":{"medium":{"w":600,"h":399,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":640,"h":426,"resize":"fit"},"small":{"w":340,"h":226,"resize":"fit"}}},{"id":449660806754738177,"id_str":"449660806754738177","indices":[121,143],"media_url":"http:\/\/pbs.twimg.com\/media\/Bj2EHxAIIAE8dtg.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Bj2EHxAIIAE8dtg.jpg","url":"http:\/\/t.co\/fxmuQN9JL9","display_url":"pic.twitter.com\/fxmuQN9JL9","expanded_url":"http:\/\/twitter.com\/FLOTUS\/status\/449660889793581056\/photo\/1","type":"photo","sizes":{"medium":{"w":600,"h":399,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":640,"h":426,"resize":"fit"},"small":{"w":340,"h":226,"resize":"fit"}}},{"id":449660808537333761,"id_str":"449660808537333761","indices":[121,143],"media_url":"http:\/\/pbs.twimg.com\/media\/Bj2EH3pIYAE4LQn.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Bj2EH3pIYAE4LQn.jpg","url":"http:\/\/t.co\/fxmuQN9JL9","display_url":"pic.twitter.com\/fxmuQN9JL9","expanded_url":"http:\/\/twitter.com\/FLOTUS\/status\/449660889793581056\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":227,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":640,"h":427,"resize":"fit"},"medium":{"w":600,"h":400,"resize":"fit"}}},{"id":449660877097406464,"id_str":"449660877097406464","indices":[121,143],"media_url":"http:\/\/pbs.twimg.com\/media\/Bj2EL3DIEAAzGAX.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/Bj2EL3DIEAAzGAX.jpg","url":"http:\/\/t.co\/fxmuQN9JL9","display_url":"pic.twitter.com\/fxmuQN9JL9","expanded_url":"http:\/\/twitter.com\/FLOTUS\/status\/449660889793581056\/photo\/1","type":"photo","sizes":{"medium":{"w":600,"h":399,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":640,"h":426,"resize":"fit"},"small":{"w":340,"h":226,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            [{"id":45297280,"id_str":"45297280","name":"Josh Dzielak","screen_name":"dzello","location":"San Francisco","description":"VP Engineering @keen_io \u2013 Analytics for Developers \u00b7 Open Source Streaker #oss365","url":"http:\/\/t.co\/yB0PmqCSdw","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/yB0PmqCSdw","expanded_url":"http:\/\/github.com\/dzello","display_url":"github.com\/dzello","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":2500,"friends_count":765,"listed_count":90,"created_at":"Sun Jun 07 06:30:05 +0000 2009","favourites_count":62004,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":4058,"lang":"en","status":{"created_at":"Tue Jul 08 03:33:45 +0000 2014","id":486352410911068160,"id_str":"486352410911068160","text":"RT @fredsters_s: And so #365daysofopensource begins. Also, dis cool: https:\/\/t.co\/90w571wUz3 h\/t @dzello http:\/\/t.co\/By4vhR56rz","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"created_at":"Tue Jul 08 02:33:01 +0000 2014","id":486337127769075712,"id_str":"486337127769075712","text":"And so #365daysofopensource begins. Also, dis cool: https:\/\/t.co\/90w571wUz3 h\/t @dzello http:\/\/t.co\/By4vhR56rz","source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":2,"favorite_count":2,"entities":{"hashtags":[{"text":"365daysofopensource","indices":[7,27]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/90w571wUz3","expanded_url":"https:\/\/github.com\/jsonresume\/resume-schema","display_url":"github.com\/jsonresume\/res\u2026","indices":[52,75]}],"user_mentions":[{"screen_name":"dzello","name":"Josh Dzielak","id":45297280,"id_str":"45297280","indices":[80,87]}],"media":[{"id":486337126917607424,"id_str":"486337126917607424","indices":[88,110],"media_url":"http:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","media_url_https":"https:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","url":"http:\/\/t.co\/By4vhR56rz","display_url":"pic.twitter.com\/By4vhR56rz","expanded_url":"http:\/\/twitter.com\/fredsters_s\/status\/486337127769075712\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":258,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":1023,"h":777,"resize":"fit"},"medium":{"w":599,"h":455,"resize":"fit"}}}]},"favorited":true,"retweeted":true,"possibly_sensitive":false,"lang":"en"},"retweet_count":2,"favorite_count":0,"entities":{"hashtags":[{"text":"365daysofopensource","indices":[24,44]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/90w571wUz3","expanded_url":"https:\/\/github.com\/jsonresume\/resume-schema","display_url":"github.com\/jsonresume\/res\u2026","indices":[69,92]}],"user_mentions":[{"screen_name":"fredsters_s","name":"Fred Stevens-Smith","id":14868289,"id_str":"14868289","indices":[3,15]},{"screen_name":"dzello","name":"Josh Dzielak","id":45297280,"id_str":"45297280","indices":[97,104]}],"media":[{"id":486337126917607424,"id_str":"486337126917607424","indices":[105,127],"media_url":"http:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","media_url_https":"https:\/\/pbs.twimg.com\/media\/Br_RCksCEAA7J5B.png","url":"http:\/\/t.co\/By4vhR56rz","display_url":"pic.twitter.com\/By4vhR56rz","expanded_url":"http:\/\/twitter.com\/fredsters_s\/status\/486337127769075712\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":258,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":1023,"h":777,"resize":"fit"},"medium":{"w":599,"h":455,"resize":"fit"}},"source_status_id":486337127769075712,"source_status_id_str":"486337127769075712"}]},"favorited":true,"retweeted":true,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"E0C8AE","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/804712707\/94c825d263f85de25ea96f410d847ac6.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/804712707\/94c825d263f85de25ea96f410d847ac6.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/378800000663269534\/8980f07490a067d022bdc174a78792bb_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/378800000663269534\/8980f07490a067d022bdc174a78792bb_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/45297280\/1383442574","profile_link_color":"2C2630","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"654C52","profile_text_color":"5A454C","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"suspended":false,"needs_phone_verification":false}]
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Pushpop::Twitter do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              let(:example_tweet) { {
         | 
| 6 | 
            +
                id_str: '449660889793581056',
         | 
| 7 | 
            +
                user: {
         | 
| 8 | 
            +
                  screen_name: 'dzello'
         | 
| 9 | 
            +
                }
         | 
| 10 | 
            +
              } }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              describe 'follow' do
         | 
| 13 | 
            +
                it 'follows a user' do
         | 
| 14 | 
            +
                  step = Pushpop::Twitter.new do |last_response|
         | 
| 15 | 
            +
                    follow last_response
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  stub_request(:post, "https://api.twitter.com/oauth2/token").
         | 
| 19 | 
            +
                    with(:body => "grant_type=client_credentials")
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  stub_request(:get, "https://api.twitter.com/1.1/account/verify_credentials.json?include_entities=false&skip_status=true").
         | 
| 22 | 
            +
                    to_return(body: File.read("spec/fixtures/dzello.json"))
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  stub_request(:post, "https://api.twitter.com/1.1/users/lookup.json").
         | 
| 25 | 
            +
                    with(:body => {:screen_name => 'dzello'}).
         | 
| 26 | 
            +
                    to_return(body: File.read("spec/fixtures/users.json"))
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  stub_request(:get, "https://api.twitter.com/1.1/friends/ids.json?cursor=-1&user_id=45297280").
         | 
| 29 | 
            +
                    to_return(body: File.read("spec/fixtures/ids.json"))
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  stub_request(:post, "https://api.twitter.com/1.1/friendships/create.json").
         | 
| 32 | 
            +
                    with(:body => {:user_id => '45297280'}).
         | 
| 33 | 
            +
                    to_return(body: File.read("spec/fixtures/dzello.json"))
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  result = step.run('dzello')
         | 
| 36 | 
            +
                  expect(result.first["screen_name"]).to eq('dzello')
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              describe 'favorite' do
         | 
| 41 | 
            +
                it 'favorites a tweet' do
         | 
| 42 | 
            +
                  step = Pushpop::Twitter.new do |last_response|
         | 
| 43 | 
            +
                    favorite last_response
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  stub_request(:post, "https://api.twitter.com/1.1/favorites/create.json").
         | 
| 47 | 
            +
                    with(:body => {:id => '449660889793581056'}).
         | 
| 48 | 
            +
                    to_return(body: File.read("spec/fixtures/status.json"))
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  stub_request(:post, "https://api.twitter.com/oauth2/token").
         | 
| 51 | 
            +
                    with(:body => "grant_type=client_credentials")
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  result = step.run(example_tweet)
         | 
| 54 | 
            +
                  expect(result.first.id).to eq(449660889793581056)
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | @@ -0,0 +1,131 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: pushpop-twitter
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
            platform: ruby
         | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - Josh Dzielak
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2014-07-08 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: pushpop
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ! '>='
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '0'
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ! '>='
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '0'
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: twitter
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ! '>='
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: '0'
         | 
| 38 | 
            +
              type: :runtime
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: '0'
         | 
| 46 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            +
              name: rake
         | 
| 48 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            +
                none: false
         | 
| 50 | 
            +
                requirements:
         | 
| 51 | 
            +
                - - ! '>='
         | 
| 52 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            +
                    version: '0'
         | 
| 54 | 
            +
              type: :development
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                none: false
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ! '>='
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            +
              name: rspec
         | 
| 64 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                none: false
         | 
| 66 | 
            +
                requirements:
         | 
| 67 | 
            +
                - - ! '>='
         | 
| 68 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            +
                    version: '0'
         | 
| 70 | 
            +
              type: :development
         | 
| 71 | 
            +
              prerelease: false
         | 
| 72 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            +
                none: false
         | 
| 74 | 
            +
                requirements:
         | 
| 75 | 
            +
                - - ! '>='
         | 
| 76 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            +
                    version: '0'
         | 
| 78 | 
            +
            description: 
         | 
| 79 | 
            +
            email: josh@keen.io
         | 
| 80 | 
            +
            executables: []
         | 
| 81 | 
            +
            extensions: []
         | 
| 82 | 
            +
            extra_rdoc_files: []
         | 
| 83 | 
            +
            files:
         | 
| 84 | 
            +
            - .gitignore
         | 
| 85 | 
            +
            - .travis.yml
         | 
| 86 | 
            +
            - Gemfile
         | 
| 87 | 
            +
            - Gemfile.lock
         | 
| 88 | 
            +
            - LICENSE
         | 
| 89 | 
            +
            - README.md
         | 
| 90 | 
            +
            - Rakefile
         | 
| 91 | 
            +
            - examples/jobs.rb
         | 
| 92 | 
            +
            - lib/pushpop-twitter.rb
         | 
| 93 | 
            +
            - lib/pushpop-twitter/version.rb
         | 
| 94 | 
            +
            - pushpop-twitter.gemspec
         | 
| 95 | 
            +
            - spec/fixtures/dzello.json
         | 
| 96 | 
            +
            - spec/fixtures/ids.json
         | 
| 97 | 
            +
            - spec/fixtures/status.json
         | 
| 98 | 
            +
            - spec/fixtures/users.json
         | 
| 99 | 
            +
            - spec/pushpop-twitter_spec.rb
         | 
| 100 | 
            +
            - spec/spec_helper.rb
         | 
| 101 | 
            +
            homepage: https://github.com/pushpop-project/pushpop-twitter
         | 
| 102 | 
            +
            licenses: []
         | 
| 103 | 
            +
            post_install_message: 
         | 
| 104 | 
            +
            rdoc_options: []
         | 
| 105 | 
            +
            require_paths:
         | 
| 106 | 
            +
            - lib
         | 
| 107 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 108 | 
            +
              none: false
         | 
| 109 | 
            +
              requirements:
         | 
| 110 | 
            +
              - - ! '>='
         | 
| 111 | 
            +
                - !ruby/object:Gem::Version
         | 
| 112 | 
            +
                  version: '0'
         | 
| 113 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 114 | 
            +
              none: false
         | 
| 115 | 
            +
              requirements:
         | 
| 116 | 
            +
              - - ! '>='
         | 
| 117 | 
            +
                - !ruby/object:Gem::Version
         | 
| 118 | 
            +
                  version: '0'
         | 
| 119 | 
            +
            requirements: []
         | 
| 120 | 
            +
            rubyforge_project: 
         | 
| 121 | 
            +
            rubygems_version: 1.8.23
         | 
| 122 | 
            +
            signing_key: 
         | 
| 123 | 
            +
            specification_version: 3
         | 
| 124 | 
            +
            summary: A set of Pushpop capabilities for the Twitter API
         | 
| 125 | 
            +
            test_files:
         | 
| 126 | 
            +
            - spec/fixtures/dzello.json
         | 
| 127 | 
            +
            - spec/fixtures/ids.json
         | 
| 128 | 
            +
            - spec/fixtures/status.json
         | 
| 129 | 
            +
            - spec/fixtures/users.json
         | 
| 130 | 
            +
            - spec/pushpop-twitter_spec.rb
         | 
| 131 | 
            +
            - spec/spec_helper.rb
         |