class CompanionApi::Resources::Login
Attributes
account[RW]
character[RW]
characters[RW]
profile[RW]
Public Class Methods
new(profile)
click to toggle source
# File lib/companion_api/resources/login.rb, line 9 def initialize(profile) @profile = profile end
Public Instance Methods
character_status()
click to toggle source
# File lib/companion_api/resources/login.rb, line 90 def character_status req = CompanionApi::Request.new( uri: @profile.get('region'), endpoint: '/character/login-status', token: @profile.get("token"), ) res = req.get! JSON.parse(res.body) end
load_character()
click to toggle source
# File lib/companion_api/resources/login.rb, line 75 def load_character req = CompanionApi::Request.new( uri: @profile.get('region'), endpoint: '/login/character', token: @profile.get("token"), ) res = req.get! json = JSON.parse(res.body) @character = json character_status end
post_auth()
click to toggle source
# File lib/companion_api/resources/login.rb, line 13 def post_auth req = CompanionApi::Request.new( uri: CompanionApi::Request::URI, endpoint: '/login/auth', requestId: CompanionApi.uuid, token: @profile.get('token'), query: { token: @profile.get('token'), uid: @profile.get('uid'), request_id: CompanionApi.uuid, }, ) res = req.post! JSON.parse(res.body) end
select_character(cid)
click to toggle source
# File lib/companion_api/resources/login.rb, line 56 def select_character(cid) req = CompanionApi::Request.new( uri: CompanionApi::Request::URI, endpoint: "/login/characters/#{cid}", token: @profile.get("token"), json: { 'appLocaleType' => 'EU', }, ) res = req.post! json = JSON.parse(res.body) region = json["region"].chomp("/") @profile.set("region", region) load_character end