lib/maxipago/request_builder/request.rb in maxipago-0.1.5 vs lib/maxipago/request_builder/request.rb in maxipago-0.1.6

- old
+ new

@@ -2,15 +2,16 @@ require 'uri' module Maxipago module RequestBuilder class Request - def initialize(maxipagoId, apiKey) - @maxipagoId = maxipagoId - @apiKey = apiKey - @apiVersion = Maxipago::Client::APIVERSION - @header = {"Content-Type" => 'text/xml'} + + def initialize(maxid, apikey) + @maxid = maxid + @apikey = apikey + @api_version = Maxipago::Client::APIVERSION + @header = { "Content-Type" => 'text/xml' } end def send_command(opts) xml = build_xml(opts) send_request(xml) @@ -20,23 +21,23 @@ def send_request(xml) set_uri set_http_session - @http_session.start {|http| - repsonse = http.post(@uri.path, xml, @header) - {header: response, body: response.body, message: response.message} + @http_session.start { |http| + response = http.post(@uri.path, xml, @header) + { header: response, body: response.body, message: response.message } } end def set_uri raise "This is an abstract method" end - def buid_xml(opts) + def build_xml(opts) raise "This is an abstract method" end - + def set_http_session @http_session = Net::HTTP.new(@uri.host, @uri.port) @http_session.use_ssl = true if @uri.scheme == "https" set_ssl_mode if @http_session.use_ssl? end \ No newline at end of file