Sha256: 847027c49060d21f2cf80021befa28ec97e578e646d218cd4fc8729884365e2e
Contents?: true
Size: 960 Bytes
Versions: 16
Compression:
Stored size: 960 Bytes
Contents
module OAuth # Superclass for tokens used by OAuth Clients class ConsumerToken < Token attr_accessor :consumer, :params attr_reader :response def self.from_hash(consumer, hash) token = self.new(consumer, hash[:oauth_token], hash[:oauth_token_secret]) token.params = hash token end def initialize(consumer, token="", secret="") super(token, secret) @consumer = consumer end # Make a signed request using given http_method to the path # # @token.request(:get, '/people') # @token.request(:post, '/people', @person.to_xml, { 'Content-Type' => 'application/xml' }) # def request(http_method, path, *arguments) @response = consumer.request(http_method, path, self, {}, *arguments) end # Sign a request generated elsewhere using Net:HTTP::Post.new or friends def sign!(request, options = {}) consumer.sign!(request, self, options) end end end
Version data entries
16 entries across 16 versions & 6 rubygems