Module: Peddler::Types::SalesV1

Defined in:
lib/peddler/types/sales_v1/error.rb,
lib/peddler/types/sales_v1/order_metrics_interval.rb,
lib/peddler/types/sales_v1/get_order_metrics_response.rb

Constant Summary collapse

Error =

Error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occured.
  attribute(:code, String)

  # @return [String] A message that describes the error condition in a human-readable form.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute(:details, String)
end
OrderMetricsInterval =

Contains order metrics.

Structure.new do
  # @return [String] The interval of time based on requested granularity (ex. Hour, Day, etc.) If this is the
  # first or the last interval from the list, it might contain incomplete data if the requested interval doesn't
  # align with the requested granularity (ex. request interval 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z and
  # granularity day will result in Sept 1st UTC day and Sept 4th UTC days having partial data).
  attribute(:interval, String)

  # @return [Integer] The number of units in orders based on the specified filters.
  attribute(:unit_count, Integer, from: "unitCount")

  # @return [Integer] The number of order items based on the specified filters.
  attribute(:order_item_count, Integer, from: "orderItemCount")

  # @return [Integer] The number of orders based on the specified filters.
  attribute(:order_count, Integer, from: "orderCount")

  # @return [Money] The average price for an item based on the specified filters. Formula is totalSales/unitCount.
  attribute(:average_unit_price, Money, from: "averageUnitPrice")

  # @return [Money] The total ordered product sales for all orders based on the specified filters.
  attribute(:total_sales, Money, from: "totalSales")
end
GetOrderMetricsResponse =

The response schema for the getOrderMetrics operation.

Structure.new do
  # @return [Array<OrderMetricsInterval>] The payload for the getOrderMetrics operation.
  attribute(:payload, [OrderMetricsInterval])

  # @return [Array<Error>] Encountered errors for the getOrderMetrics operation.
  attribute(:errors, [Error])
end