Sha256: 24338edabdcf231e3ce035cee6f259eebcba0d42001cecc7142df9d867a07b14

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'active_support/concern'

require 'twitter'

# TODO: Refactor this into a plugin. Might want to include a generator that
# creates an initializer.
module NetworkExecutive
  module Components
    module TweetPlayer
      extend ActiveSupport::Concern

      def url
        NetworkExecutive::Engine.routes.url_helpers.twitter_path
      end

      def refresh
        false
      end

      def onload
        {
          tweets: self.class.tweets[:statuses]
        }
      end

      module ClassMethods
        attr_accessor :client, :query

        def client
          @client ||= Twitter::Client.new
        end

        def configure
          yield client
        end

        def search( *args )
          @query = args
        end

        def tweets
          client.search( *query )
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
network_executive-0.0.8 lib/network_executive/components/tweet_player.rb
network_executive-0.0.7 lib/network_executive/components/tweet_player.rb