Sha256: f9adab56f805d3a1e24d1ee4ff6cae94f2a57820df0895363b6338852503272e

Contents?: true

Size: 981 Bytes

Versions: 54

Compression:

Stored size: 981 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
      @params   = {}
    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

54 entries across 51 versions & 20 rubygems

Version Path
oauth-0.5.8 lib/oauth/tokens/consumer_token.rb
oauth-0.5.7 lib/oauth/tokens/consumer_token.rb
oauth-0.5.7.pre.pre1 lib/oauth/tokens/consumer_token.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/oauth-0.5.6/lib/oauth/tokens/consumer_token.rb
oauth-0.5.6 lib/oauth/tokens/consumer_token.rb
oauth-0.5.5 lib/oauth/tokens/consumer_token.rb
tdiary-5.0.8 vendor/bundle/gems/oauth-0.5.4/lib/oauth/tokens/consumer_token.rb
oauth-0.5.4 lib/oauth/tokens/consumer_token.rb
tdiary-5.0.5 vendor/bundle/gems/oauth-0.5.3/lib/oauth/tokens/consumer_token.rb
tdiary-5.0.5 vendor/bundle/gems/oauth-0.5.1/lib/oauth/tokens/consumer_token.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/oauth-0.5.1/lib/oauth/tokens/consumer_token.rb
oauth-0.5.3 lib/oauth/tokens/consumer_token.rb
oauth-0.5.2 lib/oauth/tokens/consumer_token.rb
tdiary-5.0.4 vendor/bundle/gems/oauth-0.5.1/lib/oauth/tokens/consumer_token.rb
oauth-0.5.1 lib/oauth/tokens/consumer_token.rb
oauth-0.5.0 lib/oauth/tokens/consumer_token.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/oauth-0.4.7/lib/oauth/tokens/consumer_token.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/oauth-0.4.7/lib/oauth/tokens/consumer_token.rb
oauth-ap-0.4.8 lib/oauth/tokens/consumer_token.rb
greut-oauth-0.3.6 lib/oauth/tokens/consumer_token.rb