Class: Peddler::Reports::UnshippedOrdersReport

Inherits:
Feeds::Feed
  • Object
show all
Defined in:
lib/peddler/reports.rb

Overview

This is an unshipped orders report. It is very similar to the feed objects, so I’m just porting over the class.

Constant Summary collapse

MAPPED_PARAMS =
{
"ReportID"                  => "id",
"StartDate"                 => "starts_at",
"EndDate"                   => "ends_at",
"DownloadType"              => "type",
"Scheduled"                 => "scheduled",
"ReportStatus"              => "status",
"SubmittedDate"             => "submitted_at",
"StartedProcessingDate"     => "started_processing_at",
"CompletedProcessingDate"   => "completed_processing_at",
"CompletedProcesssingDate"  => "completed_processing_at"}

Instance Attribute Summary collapse

Attributes inherited from Feeds::Feed

#batch, #completed_processing_at, #download, #file_content, #id, #messages_processed, #messages_successful, #messages_with_errors, #messages_with_warnings, #started_processing_at, #status, #submitted_at, #type

Instance Method Summary collapse

Methods inherited from Feeds::Feed

#<<, #status!, #upload

Constructor Details

#initialize(transport, params = {}) ⇒ UnshippedOrdersReport

Creates new unshipped order report. It will send a request to Amazon to generate the report if the report ID is not already set.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/peddler/reports.rb', line 28

def initialize(transport, params={})
  super(transport)
  params.each_pair{ |key, value| self.send "#{key}=", value }
  @starts_at ||= (Date.today - 7).strftime("%Y-%m-%dT00:00:00-00:00")
  @ends_at ||= (Date.today + 1).strftime("%Y-%m-%dT00:00:00-00:00")
  #@type ||= "_GET_CONVERGED_FLAT_FILE_ACTIONABLE_ORDER_DATA_"
  @type ||= "_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_"
  if @id.nil?
    generate_report
  end
  self
end

Instance Attribute Details

#ends_atObject

Returns the value of attribute ends_at.



12
13
14
# File 'lib/peddler/reports.rb', line 12

def ends_at
  @ends_at
end

#scheduledObject

Returns the value of attribute scheduled.



12
13
14
# File 'lib/peddler/reports.rb', line 12

def scheduled
  @scheduled
end

#starts_atObject

Returns the value of attribute starts_at.



12
13
14
# File 'lib/peddler/reports.rb', line 12

def starts_at
  @starts_at
end