Sha256: aa8543f49517ee9eb27ae5bc78eff443a8ea0bf59b6058532cc5f3b8e77637e3
Contents?: true
Size: 980 Bytes
Versions: 3
Compression:
Stored size: 980 Bytes
Contents
require "net/http" require "net/https" module Moiper class Request CA_FILE = File.expand_path(File.dirname(__FILE__)) + "/cacert.pem" attr_reader :response def process(payload) @response = post(payload) Response.new(@response.body) end def client @client ||= Net::HTTP.new(uri.host, uri.port).tap do |http| http.use_ssl = true http.ca_file = CA_FILE http.verify_mode = OpenSSL::SSL::VERIFY_PEER end end def request @request ||= Net::HTTP::Post.new(uri.path).tap do |request| request.basic_auth Moiper.token, Moiper.key request.content_type = "text/xml" request["User-Agent"] = "Moiper/#{Moiper::VERSION}" end end private def post(payload) request.body = payload client.request(request) end def uri @uri ||= URI(Moiper.api_entrypoint + path) end def path "ws/alpha/EnviarInstrucao/Unica" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
moiper-0.1.1 | lib/moiper/request.rb |
moiper-0.1.0 | lib/moiper/request.rb |
moiper-0.0.1 | lib/moiper/request.rb |