Sha256: a57a9d2f32de469c7d71143b0c868f14e151cf2c8b8b1a206972d3b3659e7f52
Contents?: true
Size: 885 Bytes
Versions: 4
Compression:
Stored size: 885 Bytes
Contents
require 'net/http' module Orias # Dedicated to request handling to ORIAS API # class Request < Base attr_reader :http, :post, :uri attr_accessor :api_endpoint, :body # Initialize an Orias::Request instance def initialize(attributes = {}) super @api_endpoint ||= Orias.configuration.api_endpoint end # Build the request to be sent def build! @uri = URI(@api_endpoint) @post = Net::HTTP::Post.new(uri) @post.body = @body @post['Content-Type'] = 'application/xml' @http = Net::HTTP.new(uri.host, uri.port) @http.use_ssl = true self end # Send the built request def send! build! unless @post && @http @response = @http.request(@post) @response end # Return or set #response if not already set def response @response || send! end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
orias-0.4.1 | lib/orias/request.rb |
orias-0.4 | lib/orias/request.rb |
orias-0.3.0 | lib/orias/request.rb |
orias-0.2.0 | lib/orias/request.rb |