Sha256: 0ca0b8ee80ccd444e0263a1acb77a9182a4b5d70fd1947c5c77fa6def9986daf
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require_relative 'base' module NeonRAW module Clients # The script app client. class Script < Base def initialize(username, password, client_id, secret, opts = {}) @username = username @password = password @client_id = client_id @secret = secret @redirect_uri = opts[:redirect_uri] || 'http://127.0.0.1:' @requests_remaining = 1 @ratelimit_reset = 0 @user_agent = opts[:user_agent] || "Powered by NeonRAW v#{NeonRAW::VERSION}" authorize! end # Authorizes the client for oAuth2 requests. # @!method authorize! # @!method refresh_access! def authorize! response = auth_connection( '/api/v1/access_token', :post, grant_type: 'password', username: @username, password: @password ) data = JSON.parse(response.body, symbolize_names: true) @access = Objects::Access.new(data) end alias refresh_access! authorize! end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
NeonRAW-0.1.7 | lib/NeonRAW/clients/script.rb |