Class: IntacctRuby::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/intacct_ruby/api.rb

Overview

the gateway by which IntacctRuby::Request instances are sent off to Intacct

Instance Method Summary collapse

Constructor Details

#initialize(http_gateway = nil) ⇒ Api

Returns a new instance of Api.



4
5
6
# File 'lib/intacct_ruby/api.rb', line 4

def initialize(http_gateway = nil)
  @http_gateway = http_gateway
end

Instance Method Details

#send(request_object, post_request = nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/intacct_ruby/api.rb', line 8

def send(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