Sha256: 2f25d9ab4e74bb80703f715328f567c503872c4a1c6642088b89f468a7aa5cb4
Contents?: true
Size: 776 Bytes
Versions: 12
Compression:
Stored size: 776 Bytes
Contents
require 'rubygems' require File.dirname(__FILE__) + '/../lib/typhoeus.rb' require 'json' class Twitter include Typhoeus remote_defaults :on_success => lambda {|response| JSON.parse(response.body)}, :on_failure => lambda {|response| puts "error code: #{response.code}"}, :base_uri => "http://search.twitter.com" define_remote_method :search, :path => '/search.json' define_remote_method :trends, :path => '/trends/:time_frame.json' end tweets = Twitter.search(:params => {:q => "railsconf"}) trends = Twitter.trends(:time_frame => :current) # and then the calls don't actually happen until the first time you # call a method on one of the objects returned from the remote_method puts tweets.keys # it's a hash from parsed JSON
Version data entries
12 entries across 12 versions & 4 rubygems