class IntacctRuby::Api
the gateway by which IntacctRuby::Request
instances are sent off to Intacct
Constants
- URI_STRING
Public Class Methods
new(http_gateway = nil)
click to toggle source
# File lib/intacct_ruby/api.rb, line 4 def initialize(http_gateway = nil) @http_gateway = http_gateway end
Public Instance Methods
send_request(request_object, post_request = nil)
click to toggle source
# File lib/intacct_ruby/api.rb, line 8 def send_request(request_object, post_request = nil) post_request ||= Net::HTTP::Post.new(uri.request_uri) post_request['Content-Type'] = 'x-intacct-xml-request' post_request.body = request_object.to_xml https_request(post_request, uri) end
Private Instance Methods
https_request(request, uri)
click to toggle source
# File lib/intacct_ruby/api.rb, line 25 def https_request(request, uri) @http_gateway ||= Net::HTTP.new uri.host, uri.port @http_gateway.use_ssl = true @http_gateway.request request end
uri()
click to toggle source
# File lib/intacct_ruby/api.rb, line 21 def uri @uri ||= URI.parse URI_STRING end