Sha256: eb456cc75bf05654b4105aa82629e3b0fde6e99b385fb7287ad44876abb24614

Contents?: true

Size: 1005 Bytes

Versions: 2

Compression:

Stored size: 1005 Bytes

Contents

module MuffinMan
  class Reports < SpApiClient
    SANDBOX_REPORT_TYPE = "GET_MERCHANT_LISTINGS_ALL_DATA"
    SANDBOX_START_TIME = "2019-12-10T20:11:24.000Z"
    SANDBOX_MARKETPLACE_IDS = [
      "A1PA6795UKMFR9",
      "ATVPDKIKX0DER"
    ]

    def create_report(report_type, marketplace_ids, start_time = nil, end_time = nil, report_options = {})
      report_type = sandbox ? SANDBOX_REPORT_TYPE : report_type
      marketplace_ids = sandbox ? SANDBOX_MARKETPLACE_IDS : marketplace_ids
      start_time = sandbox ? SANDBOX_START_TIME : start_time

      @local_var_path = "/reports/2021-06-30/reports"
      @request_body = {
        "reportType" => report_type,
        "marketplaceIds" => marketplace_ids,
      }
      @request_body["dataStartTime"] = start_time unless start_time.nil?
      @request_body["dataEndTime"] = end_time unless end_time.nil?
      @request_body["reportOptions"] = report_options unless report_options.empty?
      @request_type = 'POST'
      call_api
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
muffin_man-0.2.0 lib/muffin_man/reports.rb
muffin_man-0.1.3 lib/muffin_man/reports.rb