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