class QuestradeApi::REST::OptionQuote
Public Class Methods
endpoint()
click to toggle source
# File lib/questrade_api/rest/option_quote.rb, line 26 def self.endpoint "#{BASE_ENDPOINT}/markets/quotes/options" end
fetch(authorization, params)
click to toggle source
# File lib/questrade_api/rest/option_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(optionQuotes: []) result.optionQuotes = parse_option_quotes(response.body) response = result end response end
new(params)
click to toggle source
# File lib/questrade_api/rest/option_quote.rb, line 6 def initialize(params) @raw_body = params[:data] build_data(params[:data]) if @raw_body end
Private Class Methods
parse_option_quotes(body)
click to toggle source
# File lib/questrade_api/rest/option_quote.rb, line 30 def self.parse_option_quotes(body) raw = JSON.parse(body) options = [] raw['optionQuotes'].each do |option| options << new(data: option) end options end