Sha256: ad5bd580efe6afbc52fef1add9ac2647e753c4280ea6ec3a340e953b72da6fc2

Contents?: true

Size: 647 Bytes

Versions: 1

Compression:

Stored size: 647 Bytes

Contents

require 'oauth'

module Stocktwits
  module Dispatcher
    class Oauth < OAuth::AccessToken
      include Stocktwits::Dispatcher::Shared

      attr_accessor :user

      def initialize(user)
        raise Stocktwits::Error, 'Dispatcher must be initialized with a User.' unless user.is_a?(Stocktwits::OauthUser) 
        self.user = user
        super(Stocktwits.consumer, user.access_token, user.access_secret)
      end

      def request(http_method, path, *arguments)
        path = Stocktwits.path_prefix + path
        path = append_extension_to(path)

        response = super

        handle_response(response)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stocktwits-1.0.0 lib/stocktwits/dispatcher/oauth.rb