-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explore listings management workflow
- Loading branch information
1 parent
af9fef1
commit 477265a
Showing
10 changed files
with
1,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
test/peddler/api/product_type_definitions_2020_09_01_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
103 changes: 103 additions & 0 deletions
103
test/vcr_cassettes/Peddler/API/CatalogItems20220401Test/test_search_catalog_items.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
103 changes: 103 additions & 0 deletions
103
test/vcr_cassettes/Peddler/API/ListingsItems20210801Test/test_delete_listings_item.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.