peddler 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -1
- data/VERSION.yml +1 -1
- data/lib/peddler/reports.rb +2 -2
- data/lib/peddler.rb +1 -1
- data/spec/peddler/reports_spec.rb +10 -5
- metadata +1 -1
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/lib/peddler/reports.rb
CHANGED
@@ -62,9 +62,9 @@ module Peddler
|
|
62
62
|
|
63
63
|
def process_response(res)
|
64
64
|
hash = Hash.from_xml(res)
|
65
|
-
|
65
|
+
report = Hash.from_xml(res)['Response']['Report'] || Hash.from_xml(res)['Response']['ReportsList']['Report']
|
66
|
+
report.each_pair do |key, value|
|
66
67
|
if key == "ListOfDownloads"
|
67
|
-
params = Peddler::Handlers::XMLHandler.parse(:download, value)
|
68
68
|
@download = Peddler::Feeds::Download.new(@transport, value['Download'])
|
69
69
|
@batch = Peddler::Handlers::TabDelimitedHandler.decode_response(@download.to_s)
|
70
70
|
else
|
data/lib/peddler.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),
|
1
|
+
require File.join(File.dirname(__FILE__), '/../spec_helper')
|
2
2
|
|
3
3
|
module Peddler
|
4
4
|
module Reports
|
@@ -6,13 +6,18 @@ module Peddler
|
|
6
6
|
before(:each) do
|
7
7
|
@transport = Peddler::Transport.new
|
8
8
|
@transport.modernize_request
|
9
|
-
@transport.stub!(:execute_request).and_return(
|
9
|
+
@transport.stub!(:execute_request).and_return('<?xml version="1.0"?>\n<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://merchant-query.amazon.com/query/schema/MerchantQueryResponses.xsd"><Report><ReportID>2597613290</ReportID><DownloadType>_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_</DownloadType><StartDate>2009-08-05T19:54:31+00:00</StartDate><EndDate>2009-08-12T19:54:31+00:00</EndDate><Scheduled>false</Scheduled><ReportStatus>_SUBMITTED_</ReportStatus><SubmittedDate>2009-08-12T19:54:31+00:00</SubmittedDate></Report></Response>')
|
10
10
|
@report = Peddler::Reports::UnshippedOrdersReport.new(@transport)
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
@report.id.should ==
|
15
|
-
@report.status.should ==
|
13
|
+
it 'should generate a request' do
|
14
|
+
@report.id.should == '2597613290'
|
15
|
+
@report.status.should == '_SUBMITTED_'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should update status' do
|
19
|
+
@transport.stub!(:execute_request).and_return('<?xml version="1.0"?>\n<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://merchant-query.amazon.com/query/schema/MerchantQueryResponses.xsd"><ReportsList><Report><ReportID>2893967048</ReportID><DownloadType>_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_</DownloadType><StartDate>2010-01-04T00:00:00+00:00</StartDate><EndDate>2010-01-12T00:00:00+00:00</EndDate><Scheduled>false</Scheduled><ReportStatus>_SUBMITTED_</ReportStatus><SubmittedDate>2010-01-11T06:02:40+00:00</SubmittedDate></Report></ReportsList></Response>')
|
20
|
+
@report.status!.should == '_SUBMITTED_'
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|