Sha256: cedf2e927c69333d31941bdb54424534f8a37e6d6474904fc3dec52e84cd8dc1

Contents?: true

Size: 528 Bytes

Versions: 16

Compression:

Stored size: 528 Bytes

Contents

require 'net/http'
require 'uri'

class Zapi

  attr_reader :uri, :response, :responder

  def initialize zapi_url: ENV['ZAPI_URI'], responder: nil
    @uri = URI.parse(zapi_url)
    @responder = responder || ZapiResponse
  end

  def request xml:
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE

    req = Net::HTTP::Post.new(uri.request_uri)
    req.body = xml

    @response = responder.new(raw_response: http.request(req))

    @response.data
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zaui_zapi-0.2.7 lib/zapi.rb
zaui_zapi-0.2.6 lib/zapi.rb
zaui_zapi-0.2.5 lib/zapi.rb
zaui_zapi-0.2.4 lib/zapi.rb
zaui_zapi-0.2.1 lib/zapi.rb
zaui_zapi-0.1.14 lib/zapi.rb
zaui_zapi-0.1.13 lib/zapi.rb
zaui_zapi-0.1.12 lib/zapi.rb
zaui_zapi-0.1.11 lib/zapi.rb
zaui_zapi-0.1.9 lib/zapi.rb
zaui_zapi-0.1.7 lib/zapi.rb
zaui_zapi-0.1.6 lib/zapi.rb
zaui_zapi-0.1.5 lib/zapi.rb
zaui_zapi-0.1.4 lib/zapi.rb
zaui_zapi-0.1.1 lib/zapi.rb
zaui_zapi-0.1.0 lib/zapi.rb