Sha256: 3e4c6c6a7f26b9e073238e7811d6d42d7cc742584fbdab64c8535b4dc0c28d9b
Contents?: true
Size: 946 Bytes
Versions: 4
Compression:
Stored size: 946 Bytes
Contents
require 'atol' require 'atol/errors' module Atol module Request class GetToken PATH = '/getToken'.freeze 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
atol-0.5.0 | lib/atol/request/get_token.rb |
atol-0.4.2 | lib/atol/request/get_token.rb |
atol-0.4.1 | lib/atol/request/get_token.rb |
atol-0.4 | lib/atol/request/get_token.rb |