peddler 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -10,4 +10,6 @@
10
10
  * Switched to ActiveSupport under the hood.
11
11
  * Added a purge_inventory short-hand method to the client class.
12
12
  == 0.2.1 / 2010-01-10
13
- * Nasty bug.
13
+ * Nasty bug.
14
+ == 0.2.2 / 2010-01-10
15
+ * Another nasty bug.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 2
5
5
  :build:
@@ -62,9 +62,9 @@ module Peddler
62
62
 
63
63
  def process_response(res)
64
64
  hash = Hash.from_xml(res)
65
- hash['Response']['Report'].each_pair do |key, value|
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,6 +1,6 @@
1
1
  # Peddler is a Ruby wrapper to the Amazon Inventory management API.
2
2
  module Peddler
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
 
6
6
  require 'net/https'
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "/../spec_helper")
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("<?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>")
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 "should add generate a request" do
14
- @report.id.should == "2597613290"
15
- @report.status.should == "_SUBMITTED_"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Hakan \xC5\x9Eenol Ensari"