Class: Quickeebooks::Windows::Service::SyncStatus

Inherits:
ServiceBase
  • Object
show all
Defined in:
lib/quickeebooks/windows/service/sync_status.rb

Constant Summary

Constants inherited from ServiceBase

Quickeebooks::Windows::Service::ServiceBase::XML_NS

Instance Attribute Summary

Attributes inherited from ServiceBase

#base_uri, #last_response_body, #last_response_xml, #oauth, #realm_id

Instance Method Summary collapse

Methods inherited from ServiceBase

#access_token=, #enforce_filter_order, #initialize, #url_for_base, #url_for_resource

Methods included from Logging

#log

Constructor Details

This class inherits a constructor from Quickeebooks::Windows::Service::ServiceBase

Instance Method Details

#retrieve(sync_status_request, errored_objects_only = false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/quickeebooks/windows/service/sync_status.rb', line 9

def retrieve(sync_status_request, errored_objects_only = false)
  unless sync_status_request.is_a?(Quickeebooks::Windows::Model::SyncStatusRequest)
    raise ArgumentError.new("Expecting an +SyncStatusRequest+ instance as an argument")
  end

  xml_node = sync_status_request.to_xml

  if errored_objects_only
    xml_node.set_attribute('ErroredObjectsOnly', 'true')
  end

  xml_node.set_attribute('xmlns', 'http://www.intuit.com/sb/cdm/v2')
  xml_node.set_attribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance')
  xml_node.set_attribute('xsi:schemaLocation', 'http://www.intuit.com/sb/cdm/v2 RestDataFilter.xsd ')

  xml = xml_node.to_s

  model = Quickeebooks::Windows::Model::SyncStatusResponse
  response = do_http_post(url_for_resource(model::REST_RESOURCE), xml, {}, {'Content-Type' => 'text/xml'})
  parse_collection(response, model)
end