Sha256: b16d63a1ca475f3ee2b714accf78f223649c20ad578092bd61f1de1a5f1becf8
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true require 'atol' require 'atol/errors' module Atol module Request class GetToken PATH = '/getToken' def initialize(config: nil) @config = config || Atol.config raise(Atol::ConfigExpectedError) unless @config.is_a?(Atol::Config) if @config.login.nil? || @config.login.empty? raise(Atol::MissingConfigError, 'login missing') else @login = @config.login end if @config.password.nil? || @config.login.empty? raise(Atol::MissingConfigError, 'password missing') else @password = @config.password end @http_client = @config.http_client end def call uri = URI(Atol::URL + PATH) uri.query = URI.encode_www_form(login: @login, pass: @password) http = @http_client.new(uri.host, uri.port) http.use_ssl = true http.get(uri.request_uri) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
atol-0.5.1 | lib/atol/request/get_token.rb |