Sha256: 7d79617f6c3bcd8e4b8aa73ba5a5329000107532a27272936382db6e3f170849
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
class Twitter::Client @@STATUS_URIS = { :get => '/statuses/show.json', :post => '/statuses/update.json', :delete => '/statuses/destroy.json', } # Provides access to individual statuses via Twitter's Status APIs # # <tt>action</tt> can be of the following values: # * <tt>:get</tt> to retrieve status content. Assumes <tt>value</tt> given responds to :to_i message in meaningful way to yield intended status id. # * <tt>:post</tt> to publish a new status # * <tt>:delete</tt> to remove an existing status. Assumes <tt>value</tt> given responds to :to_i message in meaningful way to yield intended status id. # # <tt>value</tt> should be set to: # * the status identifier for <tt>:get</tt> case # * the status text message for <tt>:post</tt> case # * none necessary for <tt>:delete</tt> case # # Examples: # twitter.status(:get, 107786772) # twitter.status(:post, "New Ruby open source project Twitter4R version 0.2.0 released.") # twitter.status(:delete, 107790712) # def status(action, value) return nil unless value uri = @@STATUS_URIS[action] response = nil case action when :get response = http_connect {|conn| create_http_get_request(uri, :id => value.to_i) } when :post response = http_connect({:status => value}.to_http_str) {|conn| create_http_post_request(uri) } when :delete response = http_connect {|conn| create_http_delete_request(uri, :id => value.to_i) } end bless_model(Twitter::Status.unmarshal(response.body)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter4r-0.2.0 | lib/twitter/client/status.rb |