class QuestradeApi::REST::StrategyQuote
Public Class Methods
endpoint()
click to toggle source
# File lib/questrade_api/rest/strategy_quote.rb, line 26 def self.endpoint "#{BASE_ENDPOINT}/markets/quotes/strategies" end
fetch(authorization, params)
click to toggle source
# File lib/questrade_api/rest/strategy_quote.rb, line 11 def self.fetch(authorization, params) response = post(access_token: authorization.access_token, endpoint: endpoint, url: authorization.url, body: params.to_json) if response.status == 200 result = OpenStruct.new(strategyQuotes: []) result.strategyQuotes = parse_strategy_quotes(response.body) response = result end response end
new(params)
click to toggle source
# File lib/questrade_api/rest/strategy_quote.rb, line 6 def initialize(params) @raw_body = params[:data] build_data(params[:data]) if @raw_body end
Private Class Methods
parse_strategy_quotes(body)
click to toggle source
# File lib/questrade_api/rest/strategy_quote.rb, line 30 def self.parse_strategy_quotes(body) raw = JSON.parse(body) strategies = [] raw['strategyQuotes'].each do |strategy| strategies << new(data: strategy) end strategies end