Skip to content

Commit

Permalink
Explore listings management workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanensari committed Sep 13, 2024
1 parent af9fef1 commit 477265a
Show file tree
Hide file tree
Showing 10 changed files with 1,188 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/peddler/api/catalog_items_2022_04_01_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require "helper"

require "peddler/api/catalog_items_2022_04_01"

module Peddler
class API
class CatalogItems20220401Test < Minitest::Test
def setup
super
@api = CatalogItems20220401.new(aws_region, request_access_token)
end

def test_search_catalog_items
res = @api.search_catalog_items(
["A1F83G8C2ARO7P"],
identifiers: "188864544X",
identifiers_type: "ASIN",
)

assert_predicate(res.status, :ok?)
end
end
end
end
84 changes: 84 additions & 0 deletions test/peddler/api/listings_items_2021_08_01_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# frozen_string_literal: true

require "helper"

require "peddler/api/listings_items_2021_08_01"

module Peddler
class API
class ListingsItems20210801Test < Minitest::Test
def setup
super
@api = ListingsItems20210801.new(aws_region, request_access_token)
end

def test_put_listings_item
body = {
productType: "PRODUCT",
requirements: "LISTING_OFFER_ONLY",
attributes: {
merchant_suggested_asin: [{
value: "188864544X",
marketplace_id: "A1F83G8C2ARO7P",
}],
condition_type: [{
value: "new_new",
marketplace_id: "A1F83G8C2ARO7P",
}],
merchant_shipping_group: [
{
value: "legacy-template-id",
marketplace_id: "A1F83G8C2ARO7P",
},
],
fulfillment_availability: [{
fulfillment_channel_code: "DEFAULT",
quantity: 1,
lead_time_to_ship_max_days: 3,
}],
purchasable_offer: [{
currency: "GBP",
our_price: [{
schedule: [{
value_with_tax: 400,
}],
}],
minimum_seller_allowed_price: [{
schedule: [{
value_with_tax: 350,
}],
}],
maximum_seller_allowed_price: [{
schedule: [{
value_with_tax: 450,
}],
}],
marketplace_id: "A1F83G8C2ARO7P",
}],
},
}

res = @api.put_listings_item("A34PPN1ZLYCOGT", "SKU123", "A1F83G8C2ARO7P", body)

assert_predicate(res.status, :ok?)
end

def test_get_listings_item
res = @api.get_listings_item(
"A34PPN1ZLYCOGT",
"SKU123",
"A1F83G8C2ARO7P",
included_data: "attributes,issues",
)

assert_predicate(res.status, :ok?)
end

def test_delete_listings_item
res = @api.delete_listings_item("A34PPN1ZLYCOGT", "SKU123", "A1F83G8C2ARO7P")

assert_predicate(res.status, :ok?)
end
end
end
end
27 changes: 27 additions & 0 deletions test/peddler/api/listings_restrictions_2021_08_01_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require "helper"

require "peddler/api/listings_restrictions_2021_08_01"

module Peddler
class API
class ListingsRestrictions20210801Test < Minitest::Test
def setup
super
@api = ListingsRestrictions20210801.new(aws_region, request_access_token)
end

def test_get_listings_restrictions
res = @api.get_listings_restrictions(
"188864544X",
"A34PPN1ZLYCOGT",
"A1F83G8C2ARO7P",
condition_type: "new_new",
)

assert_predicate(res.status, :ok?)
end
end
end
end
32 changes: 32 additions & 0 deletions test/peddler/api/product_type_definitions_2020_09_01_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require "helper"

require "peddler/api/product_type_definitions_2020_09_01"

module Peddler
class API
class ProductTypeDefinitions20200901Test < Minitest::Test
def setup
super
@api = ProductTypeDefinitions20200901.new(aws_region, request_access_token)
end

def test_get_definitions_product_type
res = @api.get_definitions_product_type(
"PRODUCT",
"A1F83G8C2ARO7P",
requirements: "LISTING_OFFER_ONLY",
)

assert_predicate(res.status, :ok?)

# And download the JSON schema
url = res.parse.dig("schema", "link", "resource")
json_schema = HTTP.get(url).parse(:json)

assert(json_schema)
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 477265a

Please sign in to comment.