b0VIM 7.4W,4kdale.hamelmainframe/u/workspace/personal/questrade_client/lib/questrade_client/client.rbutf-8 3210#"! UtpVadIVu_+"^,  m 1 t c [ U T E # "  i %    ^ V U 8    _ N C 7 - % $ q4e[SMIHeend end end end f.adapter Faraday.default_adapter f.response :json, content_type: /\bjson$/ f.response :mashify # f.response :logger f.headers['Authorization'] = "Bearer #{@token}" f.headers[:user_agent] = QuestradeClient::USER_AGENT f.request :json @connection ||= Faraday.new @endpoint do |f| def connection # @return [Faraday::Connection] # # Returns a Faraday::Connection object end end res else res.body if res.success? && !res.body.nil? && !res.body.empty? && res.body != ' ' res = connection.send(method, "v1/#{path}", data) def request(method, path, data = {}) end request(:put, path, data) def put(path, data = {}) end request(:post, path, data) def post(path, data = {}) end request(:get, path, options) def get(path, options = {}) private include QuestradeClient::Account end raise ArgumentError, ":token can't be blank" if @token.empty? raise ArgumentError, ":endpoint can't be blank" if @endpoint.empty? @token = options[:token].to_s @endpoint = options[:endpoint].to_s def initialize(options = {}) attr_reader :endpoint, :token class Client end end return nil# puts r.body# puts "Login failed!" else return Client.new(endpoint: endpoint, token: token) token = r.body['access_token'] endpoint = r.body['api_server']# puts "New refresh token: #{r.body['refresh_token']}" if r.success? r = conn.send(:post, endpoint) endpoint = "#{url}token?grant_type=refresh_token&refresh_token=#{refresh_token}" end f.adapter Faraday.default_adapter f.response :json, content_type: /\bjson$/ f.headers['Content-length'] = '0' f.headers[:user_agent] = QuestradeClient::USER_AGENT conn = Faraday.new @endpoint do |f| end "https://login.questrade.com/oauth2/" else "https://practicelogin.questrade.com/oauth2/" url = if practice def self.login(refresh_token, practice = false)module QuestradeClientrequire 'faraday_middleware'require 'questrade_client/account'