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.1.0 examples/twitter_oauth.rb