Sha256: 71a6bcaf851a4f715933b19ad877ace515ec73fdc8eab7609e7b3de5fe3c8c63
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module Twitter class HTTPAuth include HTTParty format :plain attr_reader :username, :password, :options def initialize(username, password, options={}) @username, @password = username, password @options = {:ssl => false}.merge(options) options[:api_endpoint] ||= "api.twitter.com" self.class.base_uri "http#{'s' if options[:ssl]}://#{options[:api_endpoint]}" end def get(uri, headers={}) self.class.get(uri, :headers => headers, :basic_auth => basic_auth) end def post(uri, body={}, headers={}) self.class.post(uri, :body => body, :headers => headers, :basic_auth => basic_auth) end def put(uri, body={}, headers={}) self.class.put(uri, :body => body, :headers => headers, :basic_auth => basic_auth) end def delete(uri, body={}, headers={}) self.class.delete(uri, :body => body, :headers => headers, :basic_auth => basic_auth) end private def basic_auth @basic_auth ||= {:username => @username, :password => @password} end end end
Version data entries
4 entries across 4 versions & 2 rubygems