lib/peddler/client.rb in peddler-0.2.0 vs lib/peddler/client.rb in peddler-0.2.1

- old
+ new

@@ -17,24 +17,24 @@ params.each_pair { |key, value| self.send("#{key}=", value.to_s) } end # Sets username. def username=(username) - self.transport.username = username + transport.username = username end # Sets password. def password=(password) - self.transport.password = password + transport.password = password end # Sets Amazon region. # # client.region = :jp # def region=(region) - self.transport.region = region.to_s + transport.region = region.to_s end # Creates an inventory batch. # # batch = client.new_inventory_batch @@ -51,19 +51,19 @@ # report = client.new_report :upload, :id => batch.id # p report.body # => "Feed Processing Summary:\n\tNumber of records processed\t\t1\n\tNumber of records successful\t\t1\n\n" # def new_inventory_batch - Peddler::Inventory::Batch.new(self.transport.dup) + Peddler::Inventory::Batch.new(transport.dup) end # A short-hand method to purge inventory. # # client.purge_inventory # def purge_inventory - empty_batch = Peddler::Inventory::Batch.new(self.transport.dup) + empty_batch = Peddler::Inventory::Batch.new(transport.dup) empty_batch.upload(:method => 'purge') end # Creates an inventory item. Parameter keys are lowercased and underscored but otherwise the same as @@ -72,11 +72,11 @@ Peddler::Inventory::Item.new(params) end # Returns count of pending inventory uploads queued at Amazon. def inventory_queue - Peddler::Inventory::Queue.count(self.transport) + Peddler::Inventory::Queue.count(transport) end # Creates an order fulfillment batch. # # feed = client.new_order_fulfillment_feed @@ -91,11 +91,11 @@ # feed.status! # => "_DONE_" # p feed.download.to_s # def new_order_fulfillment_feed - Peddler::Feeds::OrderFulfillment::Batch.new(self.transport.dup) + Peddler::Feeds::OrderFulfillment::Batch.new(transport.dup) end # Creates an item that can then be added to an order fulfillment feed. Keys are lowercased and underscored but # otherwise the same as Amazon's headers. See section 7.1 in the API docs. def new_fulfilled_order(params={}) @@ -117,11 +117,11 @@ # feed.status! # => "_DONE_" # p feed.download.to_s # def new_order_cancellation_feed - Peddler::Feeds::OrderCancellation::Batch.new(self.transport.dup) + Peddler::Feeds::OrderCancellation::Batch.new(transport.dup) end # Creates an item that can then be added to an order cancellation feed. Keys are lowercased and underscored but # otherwise the same as Amazon's headers. See section 7.4 in the API docs. def new_cancelled_order(params={}) @@ -146,11 +146,11 @@ # :id => status[0].id) # p report.body # => "123-1234567-1234567order-item-id: 12341234567890\tSUCCESS 10.00 is Refunded.\r\n" # def new_refund_batch - Peddler::Refunds::Batch.new(self.transport.dup) + Peddler::Refunds::Batch.new(transport.dup) end # Creates a refund item that can then be added to a refund batch. # # Possible reasons: ["GeneralAdjustment", "CouldNotShip", "DifferentItem", "MerchandiseNotReceived", "MerchandiseNotAsDescribed"] @@ -182,22 +182,22 @@ # preorders = client.detab(preorders_report.body) # preorders[0].average_asking_price # => "100" # def new_report(name,params={}) - Peddler::LegacyReports::Report.new(self.transport.dup, name, params) + Peddler::LegacyReports::Report.new(transport.dup, name, params) end # Requests a report. Returns true when successful. # # Possible report names: [:order, :open_listings, :open_listings_lite, :open_listings_liter] # # client.generate_report :order, :number_of_days => 15 # # A word of caution. Open listings may crap up with larger inventories. def generate_report(name,params={}) - Peddler::LegacyReports.generate(self.transport, name, params) + Peddler::LegacyReports.generate(transport, name, params) end # Creates an unshipped order report. Takes on some optional parameters, such as :id, :starts_at, :ends_at. By default, # it will request a new unshipped order report for the past seven days. # @@ -208,20 +208,20 @@ # report.status! # => "_DONE_" # p report.unshipped_orders # def new_unshipped_orders_report(params={}) - Peddler::Reports::UnshippedOrdersReport.new(self.transport.dup, params) + Peddler::Reports::UnshippedOrdersReport.new(transport.dup, params) end # Returns status of most recent reports. Optional "count" defaults to 10. Name can be [ :upload, :order, :batch_refund, :open_listings, :open_listings_lite, :open_listings_liter ]. # # reports = client.latest_reports :order, :count => 1 # reports[0] # => #<Peddler::LegacyReports::ReportStatus starts_at="07-29-2009:10-00-06" ... # def latest_reports(name,params={}) - Peddler::LegacyReports.latest(self.transport, name, params) + Peddler::LegacyReports.latest(transport, name, params) end # Decodes tab-delimited content into an array of OpenStruct objects. def detab(msg) Peddler::Handlers::TabDelimitedHandler.decode_response(msg)