Sha256: 633accb97246ae18ad5bfe777eb8f5eec97d7e6389f3f7f7de0f19922c4dd65a

Contents?: true

Size: 718 Bytes

Versions: 41

Compression:

Stored size: 718 Bytes

Contents

require "rubygems"
require "bundler/setup"
require "./examples/config" if File.exists?('examples/config.rb')
require "api_client"

module TwitterOauth

  class Base < ApiClient::Base

    always do
      endpoint "https://api.twitter.com/"
      adapter  :oauth

      options  :oauth => {
        :consumer_key => TWITTER_CONSUMER_KEY, :consumer_secret => TWITTER_CONSUMER_SECRET
      }

    end

  end

  class Tweet < Base

    def self.tweet(message)
      build post('/1/statuses/update.json', :status => message)
    end

  end

end

config = { :token => TWITTER_TOKEN, :token_secret => TWITTER_SECRET }

message = TwitterOauth::Tweet.options(:oauth => config).tweet("test #{Time.now.to_i}")

puts message.text

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
api_client-0.5.24 examples/twitter_oauth.rb
api_client-0.5.22 examples/twitter_oauth.rb
api_client-0.5.21 examples/twitter_oauth.rb
api_client-0.5.20 examples/twitter_oauth.rb
api_client-0.5.19 examples/twitter_oauth.rb
api_client-0.5.18 examples/twitter_oauth.rb
api_client-0.5.17 examples/twitter_oauth.rb
api_client-0.5.16 examples/twitter_oauth.rb
api_client-0.5.15 examples/twitter_oauth.rb
api_client-0.5.14 examples/twitter_oauth.rb
api_client-0.5.13 examples/twitter_oauth.rb
api_client-0.5.12 examples/twitter_oauth.rb
api_client-0.5.11 examples/twitter_oauth.rb
api_client-0.5.9 examples/twitter_oauth.rb
api_client-0.5.7 examples/twitter_oauth.rb
api_client-0.5.6 examples/twitter_oauth.rb
api_client-0.5.5 examples/twitter_oauth.rb
api_client-0.5.4 examples/twitter_oauth.rb
api_client-0.5.3 examples/twitter_oauth.rb
api_client-0.5.2 examples/twitter_oauth.rb