lib/peddler/legacy_reports.rb in peddler-0.1.3 vs lib/peddler/legacy_reports.rb in peddler-0.2.0
- old
+ new
@@ -1,8 +1,10 @@
module Peddler
+
# This module contains methods to manage legacy reports -- anything that comes before section 7 in the API docs.
module LegacyReports
+
# Returns statuses of most recent reports in an array of OpenStructs.
def self.latest(transport,name,params={})
transport.legacize_request
if name == :upload
transport.path << "catalog-upload/get-batches"
@@ -11,11 +13,10 @@
transport.path << "manual-reports/get-report-status"
transport.headers[:report_name] = name.to_s.camelize
transport.headers[:number_of_reports] = params[:count] if params[:count]
end
res = transport.execute_request
- xml = Peddler::Handlers::XMLHandler.decode_response(res)
- Peddler::Handlers::XMLHandler.parse_legacy(xml)
+ Peddler::Handlers::XMLHandler.parse_legacy(Hash.from_xml(res))
end
# Requests a report to be generated and returns the report instance if request is successful.
def self.generate(transport,name,params={})
transport.legacize_request
\ No newline at end of file