Sha256: 3a4092cbe845a8e4e4d0879ad529f5aee9e50fe8b095d4674df021b9d49c3861

Contents?: true

Size: 597 Bytes

Versions: 41

Compression:

Stored size: 597 Bytes

Contents

require "rubygems"
require "bundler/setup"
require "api_client"

module Twitter

  class Base < ApiClient::Base
    always do
      endpoint    "http://api.twitter.com/"
    end
  end

  class Tweet < Base
  end

  class User < Base

    def self.find_by_username(name)
      params(:screen_name => name).fetch("/1/users/show.json")
    end

    def tweets
      Tweet.params(:screen_name => self.screen_name).fetch("/1/statuses/user_timeline.json")
    end

  end

end

user = Twitter::User.find_by_username("marcinbunsch")
puts user.name
user.tweets.each do |tweet|
  puts "  #{tweet.text}"
end

Version data entries

41 entries across 41 versions & 1 rubygems

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