Sha256: 13d7ef528b71b8e73eb0b7decba8411054de3f78f3eb883244666a65909c7476
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
Pu ||= Iro::Purse Str ||= Iro::Strategy Po ||= Iro::Position O ||= Iro::Option Sto ||= Iro::Stock class Schwab include HTTParty debug_output $stdout end class Iro::ApplicationController < Wco::ApplicationController layout 'iro/application' before_action :set_lists, except: %i| schwab_sync | def home authorize! :home, Iro end def schwab_sync authorize! :shwab_sync, Iro profile = Wco::Profile.find_by email: 'piousbox@gmail.com' out = Schwab.post( "https://api.schwabapi.com/v1/oauth/token", { headers: { "Content-Type": "application/x-www-form-urlencoded", }, basic_auth: { username: SCHWAB_DATA[:key], password: SCHWAB_DATA[:secret] }, body: { grant_type: 'refresh_token', refresh_token: profile.schwab_refresh_token }, }) out = out.parsed_response puts! out, 'out' attrs = { schwab_access_token: out['access_token'], schwab_refresh_token: out['refresh_token'], schwab_id_token: out['id_token'], } puts! attrs, 'attrs' # profile.update(attrs) # profile.save! render json: { status: :ok } end ## ## private ## private def set_lists @purses = Iro::Purse.all @strategies = Iro::Strategy.all @strategies_list = Iro::Strategy.list end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iron_warbler-2.0.7.30 | app/controllers/iro/application_controller.rb |