From 74e2611e87acaf80bc56134a07e66ae1248b2aa0 Mon Sep 17 00:00:00 2001 From: Dan Milne Date: Fri, 21 Aug 2020 16:14:58 +1000 Subject: [PATCH] Update Changes. Update test data. Amazon has added RoleType and the test file didn't include it. --- CHANGELOG.md | 3 + test/data/get_item_bad_contributor.json | 176 ------------------------ test/data/items_get_B079PQ7T6B.json | 71 +++++++--- test/item_test.rb | 17 +-- 4 files changed, 57 insertions(+), 210 deletions(-) delete mode 100644 test/data/get_item_bad_contributor.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 68bf069..027fc31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.2 +- Use Contributor RoleType, rather than Role. RoleType uses lowercase, rather than capitalised. + ## 0.1.0 - Remove Nameable dependancy and return the data as the API returns it. diff --git a/test/data/get_item_bad_contributor.json b/test/data/get_item_bad_contributor.json deleted file mode 100644 index 89b6d4d..0000000 --- a/test/data/get_item_bad_contributor.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "ItemsResult": { - "Items": [ - { - "ASIN": "055357342X", - "DetailPageURL": "https://www.amazon.co.uk/dp/055357342X?tag=bookie0a-21&linkCode=ogi&th=1&psc=1", - "Images": { - "Primary": { - "Large": { - "Height": 500, - "URL": "https://m.media-amazon.com/images/I/51e6nhYq5TL.jpg", - "Width": 305 - } - } - }, - "ItemInfo": { - "ByLineInfo": { - "Contributors": [ - { - "Locale": "en_GB", - "Name": ".", - "Role": "Author" - } - ], - "Manufacturer": { - "DisplayValue": "Non Basic Stock Line", - "Label": "Manufacturer", - "Locale": "en_GB" - } - }, - "ContentInfo": { - "Languages": { - "DisplayValues": [ - { - "DisplayValue": "English", - "Type": "Published" - }, - { - "DisplayValue": "English", - "Type": "Original Language" - }, - { - "DisplayValue": "English", - "Type": "Unknown" - } - ], - "Label": "Language", - "Locale": "en_GB" - }, - "PagesCount": { - "DisplayValue": 1216, - "Label": "NumberOfPages", - "Locale": "en_US" - }, - "PublicationDate": { - "DisplayValue": "2003-03-31T00:00:01Z", - "Label": "PublicationDate", - "Locale": "en_US" - } - }, - "ExternalIds": { - "EANs": { - "DisplayValues": [ - "9780553573428", - "8601419066322" - ], - "Label": "EAN", - "Locale": "en_US" - }, - "ISBNs": { - "DisplayValues": [ - "055357342X", - "9780553573428" - ], - "Label": "ISBN", - "Locale": "en_US" - } - }, - "ManufactureInfo": { - "ItemPartNumber": { - "DisplayValue": "2606220", - "Label": "PartNumber", - "Locale": "en_US" - } - }, - "ProductInfo": { - "ItemDimensions": { - "Height": { - "DisplayValue": 6.79, - "Label": "Height", - "Locale": "en_GB", - "Unit": "Inches" - }, - "Length": { - "DisplayValue": 4.15, - "Label": "Length", - "Locale": "en_GB", - "Unit": "Inches" - }, - "Weight": { - "DisplayValue": 1.1, - "Label": "Weight", - "Locale": "en_GB", - "Unit": "Pounds" - }, - "Width": { - "DisplayValue": 1.84, - "Label": "Width", - "Locale": "en_GB", - "Unit": "Inches" - } - }, - "ReleaseDate": { - "DisplayValue": "2003-03-31T00:00:01Z", - "Label": "ReleaseDate", - "Locale": "en_US" - }, - "UnitCount": { - "DisplayValue": 1, - "Label": "NumberOfItems", - "Locale": "en_US" - } - }, - "Title": { - "DisplayValue": "A Storm of Swords: 3 (Song of Ice and Fire)", - "Label": "Title", - "Locale": "en_GB" - } - }, - "Offers": { - "Listings": [ - { - "Availability": { - "Message": "In stock." - }, - "Condition": { - "SubCondition": { - "Value": "Good" - }, - "Value": "Used" - }, - "DeliveryInfo": { - "IsAmazonFulfilled": false, - "IsFreeShippingEligible": false, - "IsPrimeEligible": false - }, - "Id": "qEdfDwnCbF1NN%2BoQaXjEqwhIlFU7YWAAbBQQwHwmcADHFnoCIv5Togd4trXxwSzuMkkctQROwxy%2FU6ji1KMHtObuOdTk%2Bj6nsFYvij%2F2qZE2XlsDsmnX8Lp1w4ySASam7wCQy5XDtxA7Rt%2BWtYWS0NMRzYw0C9lU", - "MerchantInfo": { - "DefaultShippingCountry": "GB", - "Id": "A2P4VIAF254M7F", - "Name": "The Cotswold Library" - }, - "Price": { - "Amount": 3.44, - "Currency": "GBP", - "DisplayAmount": "£3.44", - "Savings": { - "Amount": 6.55, - "Currency": "GBP", - "DisplayAmount": "£6.55 (66%)", - "Percentage": 66 - } - }, - "SavingBasis": { - "Amount": 9.99, - "Currency": "GBP", - "DisplayAmount": "£9.99" - }, - "ViolatesMAP": false - } - ] - } - } - ] - } -} \ No newline at end of file diff --git a/test/data/items_get_B079PQ7T6B.json b/test/data/items_get_B079PQ7T6B.json index de744bb..2768887 100644 --- a/test/data/items_get_B079PQ7T6B.json +++ b/test/data/items_get_B079PQ7T6B.json @@ -8,8 +8,8 @@ "Primary": { "Large": { "Height": 500, - "URL": "https://m.media-amazon.com/images/I/4107DRyNZpL.jpg", - "Width": 327 + "URL": "https://m.media-amazon.com/images/I/41yp1zQdxqL.jpg", + "Width": 500 } } }, @@ -24,7 +24,8 @@ { "Locale": "en_AU", "Name": "Funko Pop! Marvel:", - "Role": "Artist" + "Role": "Artist", + "RoleType": "artist" } ], "Manufacturer": { @@ -34,6 +35,16 @@ } }, "ContentInfo": { + "Languages": { + "DisplayValues": [ + { + "DisplayValue": "English", + "Type": "Published" + } + ], + "Label": "Language", + "Locale": "en_AU" + }, "PublicationDate": { "DisplayValue": "2018-04-04T00:00:01Z", "Label": "PublicationDate", @@ -60,10 +71,9 @@ }, "Features": { "DisplayValues": [ - "From Avengers Infinity War, Thanos, as a stylized POP vinyl from Funko!", - "Stylized collectable stands 3 ¾ inches tall, perfect for any Avengers Infinity War fan!", - "Collect and display all Avengers Infinity War POP! Vinyls!", - "Funko POP! is the 2017 Toy of the Year and People's Choice award winner" + "Stylized collectable stands 3 ¾ inches tall, perfect for any Avengers 3 fan!", + "Collect and display all, Avengers 3 Pop! Vinyl's!", + "Check out the other Avengers 3 figures from Funko!" ], "Label": "Features", "Locale": "en_AU" @@ -78,6 +88,11 @@ "DisplayValue": "26467", "Label": "Model", "Locale": "en_US" + }, + "Warranty": { + "DisplayValue": "No Warranty", + "Label": "Warranty", + "Locale": "en_AU" } }, "ProductInfo": { @@ -92,15 +107,33 @@ "Locale": "en_US" }, "ItemDimensions": { + "Height": { + "DisplayValue": 3.75, + "Label": "Height", + "Locale": "en_AU", + "Unit": "Inches" + }, + "Length": { + "DisplayValue": 2.5, + "Label": "Length", + "Locale": "en_AU", + "Unit": "Inches" + }, "Weight": { - "DisplayValue": 0.85, + "DisplayValue": 1.873929227, "Label": "Weight", "Locale": "en_AU", - "Unit": "Kilograms" + "Unit": "Pounds" + }, + "Width": { + "DisplayValue": 2.5, + "Label": "Width", + "Locale": "en_AU", + "Unit": "Inches" } }, "ReleaseDate": { - "DisplayValue": "2018-03-03T00:00:01Z", + "DisplayValue": "2019-10-17T00:00:01Z", "Label": "ReleaseDate", "Locale": "en_US" }, @@ -116,7 +149,7 @@ } }, "Title": { - "DisplayValue": "FUNKO POP! Marvel: Avengers Infinity War - Thanos", + "DisplayValue": "Funko FUN26467 Action Figure", "Label": "Title", "Locale": "en_AU" } @@ -134,19 +167,19 @@ "Value": "New" }, "DeliveryInfo": { - "IsAmazonFulfilled": false, - "IsFreeShippingEligible": false, - "IsPrimeEligible": false + "IsAmazonFulfilled": true, + "IsFreeShippingEligible": true, + "IsPrimeEligible": true }, - "Id": "wGlzfgGjBBliOSAG21fYMCH27rYsl4J4q7XnxRDHzyAg8wXkOtJYJV3XrAsR1zd8kkVI0sXgIB%2FGfjyncUv1N43Propx%2B8VnOndyVTyEM0T0%2Fbrd06MYbAgns8Vbs%2BhEePoX6WOKsIrnsVJOPa%2FLS%2FPuUlyyFluU", + "Id": "m4oBvLF80AQ1QcznanMQGoFQaAZPT4Zsdo55%2Bb0YB%2FZpO%2F5daaIdhiLUd89%2FkBrWURvZ%2B%2B716QfBjkN0WUUBJp7%2BccDF5ZMNUEzQMDnNPgHmprZ2S8HURd7hb9%2F%2FTS5R", "MerchantInfo": { - "Id": "A3A83J10WISLAT", - "Name": "SupportiveSolutions" + "Id": "ANEGB3WVEVKZB", + "Name": "Amazon AU" }, "Price": { - "Amount": 17.99, + "Amount": 19.99, "Currency": "AUD", - "DisplayAmount": "$17.99" + "DisplayAmount": "$19.99" }, "ViolatesMAP": false } diff --git a/test/item_test.rb b/test/item_test.rb index 39de9fe..ee07b1e 100644 --- a/test/item_test.rb +++ b/test/item_test.rb @@ -28,9 +28,9 @@ class ItemTest < Minitest::Test item_count: 1, items: [ { - title: "FUNKO POP! Marvel: Avengers Infinity War - Thanos", + title: "Funko FUN26467 Action Figure", asin: 'B079PQ7T6B', - image_url: 'https://m.media-amazon.com/images/I/4107DRyNZpL.jpg', + image_url: 'https://m.media-amazon.com/images/I/41yp1zQdxqL.jpg', eans: ["0889698264679", "0615912346988"], authors: [], artists: ['Funko Pop! Marvel:'], @@ -64,19 +64,6 @@ class ItemTest < Minitest::Test artists: [] } ] - }, - { - name: 'Bad Contributors', - response: 'get_item_bad_contributor.json', - item_count: 1, - items: [ - { - asin: "055357342X", - authors: ['.'], - illustrators: [], - artists: [] - } - ] } ]