Skip to content

Commit

Permalink
Convert document links to full URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanensari committed Sep 24, 2024
1 parent a12f8d4 commit d9be131
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
11 changes: 11 additions & 0 deletions bin/generate-code
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,26 @@ module Generator
text.gsub(%r{<a href=['"]([^'"]+)['"]>([^<]+)</a>}) do
url = Regexp.last_match(1)
link_text = Regexp.last_match(2)

"[#{link_text}](#{url})"
end
end

def convert_doc_links_to_full_url(text)
text.gsub(/\[([^\]]+)\]\(doc:([^\)]+)\)/) do
link_text = Regexp.last_match(1)
path = Regexp.last_match(2)

"[#{link_text}](https://developer-docs.amazon.com/sp-api/docs/#{path})"
end
end

def clean_description(description)
return "" unless description

description = description.gsub("**Note:**", "@note")
description = convert_links_to_markdown(description)
description = convert_doc_links_to_full_url(description)
lines = description.split("\n")
usage_plan_index = lines.find_index { |line| line.downcase.include?("usage plan") }
lines = lines[0...usage_plan_index] if usage_plan_index
Expand Down
12 changes: 7 additions & 5 deletions lib/peddler/api/catalog_items_v0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class API
class CatalogItemsV0 < API
# Effective September 30, 2022, the `listCatalogItems` operation will no longer be available in the Selling
# Partner API for Catalog Items v0. As an alternative, `searchCatalogItems` is available in the latest version of
# the [Selling Partner API for Catalog Items v2022-04-01](doc:catalog-items-api-v2022-04-01-reference).
# the [Selling Partner API for Catalog Items
# v2022-04-01](https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference).
# Integrations that rely on the `listCatalogItems` operation should migrate to the `searchCatalogItems`operation
# to avoid service disruption. _Note:_ The [`listCatalogCategories`](#get-catalogv0categories) operation is not
# being deprecated and you can continue to make calls to it.
Expand Down Expand Up @@ -54,10 +55,11 @@ def list_catalog_items(marketplace_id, query: nil, query_context_id: nil, seller

# Effective September 30, 2022, the `getCatalogItem` operation will no longer be available in the Selling Partner
# API for Catalog Items v0. This operation is available in the latest version of the [Selling Partner API for
# Catalog Items v2022-04-01](doc:catalog-items-api-v2022-04-01-reference). Integrations that rely on this
# operation should migrate to the latest version to avoid service disruption. _Note:_ The
# [`listCatalogCategories`](#get-catalogv0categories) operation is not being deprecated and you can continue to
# make calls to it.
# Catalog Items
# v2022-04-01](https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference).
# Integrations that rely on this operation should migrate to the latest version to avoid service disruption.
# _Note:_ The [`listCatalogCategories`](#get-catalogv0categories) operation is not being deprecated and you can
# continue to make calls to it.
#
# @note This operation can make a static sandbox call.
# @param [String] marketplace_id A marketplace identifier. Specifies the marketplace for the item.
Expand Down
25 changes: 14 additions & 11 deletions lib/peddler/api/easy_ship_2022_03_23.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ class EasyShip20220323 < API
# Returns time slots available for Easy Ship orders to be scheduled based on the package weight and dimensions
# that the seller specifies. This operation is available for scheduled and unscheduled orders based on marketplace
# support. See **Get Time Slots** in the [Marketplace Support
# Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table). This operation can return time
# slots that have either pickup or drop-off handover methods - see **Supported Handover Methods** in the
# [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
# Table](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
# This operation can return time slots that have either pickup or drop-off handover methods - see **Supported
# Handover Methods** in the [Marketplace Support
# Table](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
#
# @note This operation can make a static sandbox call.
# @param [Hash] list_handover_slots_request The request schema for the `listHandoverSlots` operation.
Expand Down Expand Up @@ -53,12 +54,13 @@ def get_scheduled_package(amazon_order_id, marketplace_id, rate_limit: 1.0)
# Specifies the time slot and handover method for the order to be scheduled for delivery. * Updates the Easy Ship
# order status. * Generates a shipping label and an invoice. Calling `createScheduledPackage` also generates a
# warranty document if you specify a `SerialNumber` value. To get these documents, see [How to get invoice,
# shipping label, and warranty documents](doc:easyship-api-v2022-03-23-use-case-guide). * Shows the status of Easy
# Ship orders when you call the `getOrders` operation of the Selling Partner API for Orders and examine the
# `EasyShipShipmentStatus` property in the response body. See the **Shipping Label**, **Invoice**, and
# shipping label, and warranty
# documents](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide). * Shows the
# status of Easy Ship orders when you call the `getOrders` operation of the Selling Partner API for Orders and
# examine the `EasyShipShipmentStatus` property in the response body. See the **Shipping Label**, **Invoice**, and
# **Warranty** columns in the [Marketplace Support
# Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which documents are
# supported in each marketplace.
# Table](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)
# to see which documents are supported in each marketplace.
#
# @note This operation can make a static sandbox call.
# @param [Hash] create_scheduled_package_request The request schema for the `createScheduledPackage` operation.
Expand All @@ -74,8 +76,8 @@ def create_scheduled_package(create_scheduled_package_request, rate_limit: 1.0)
# Updates the time slot for handing over the package indicated by the specified `scheduledPackageId`. You can get
# the new `slotId` value for the time slot by calling the `listHandoverSlots` operation before making another
# `patch` call. See the **Update Package** column in the [Marketplace Support
# Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which marketplaces this
# operation is supported in.
# Table](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)
# to see which marketplaces this operation is supported in.
#
# @note This operation can make a static sandbox call.
# @param [Hash] update_scheduled_packages_request The request schema for the `updateScheduledPackages` operation.
Expand All @@ -90,7 +92,8 @@ def update_scheduled_packages(update_scheduled_packages_request: nil, rate_limit

# This operation automatically schedules a time slot for all the `amazonOrderId`s given as input, generating the
# associated shipping labels, along with other compliance documents according to the marketplace (refer to the
# [marketplace document support table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)).
# [marketplace document support
# table](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)).
# Developers calling this operation may optionally assign a `packageDetails` object, allowing them to input a
# preferred time slot for each order in ther request. In this case, Amazon will try to schedule the respective
# packages using their optional settings. On the other hand, *i.e.*, if the time slot is not provided, Amazon will
Expand Down

0 comments on commit d9be131

Please sign in to comment.