Etsy sync WordPress plugin 12

Getting some data from Etsy API.

Recap

I’ve developed the two main classes I will be using for Etsy Little Helper project: the one taking care of retrieving the user shops (the ShopRetriever class) and the one in charge of retrieving a shop listings (the ListingRetriever class).
But those two classes, as relevant as they might be, are just two chains rings in the chain of responsibility that’s to retrieve the information from Etsy and sync that content to WordPress; as such I need to know what’s coming in from the API for each of those requests.

Making the requests

Etsy API is well documented to say the least and setting up some requests is a matter of finding a REST client. The request for a user shops will yield results like this one if everything is ok (and I’ve taken care to anonimize it using the sweet LoremGibson package so any sense it might make is casual)

{
    "count": 1,
    "results": [
        {
            "shop_id": 3333333,
            "shop_name": "AnEtsyShop",
            "user_id": 55555555,
            "creation_tsz": 1393407522,
            "title": "Denim nodal point market DIY saturation",
            "announcement": "San Francisco geodesic rain knife office-ware concrete j-pop fluidity-space range-rover tanto free-market dead. Knife 3D-printed faded sunglasses cartel wristwatch hacker pen kanji sensory decay garage singularity.",
            "currency_code": "EUR",
            "is_vacation": false,
            "vacation_message": "Be back soon",
            "sale_message": "Corrupted smart-bridge gang rebar youtube spook pre-futurity carbon.",
            "digital_sale_message": null,
            "last_updated_tsz": 1427289394,
            "listing_active_count": 86,
            "login_name": "johndoe",
            "accepts_custom_requests": false,
            "policy_welcome": "Render-farm tube Tokyo A.I. gang Chiba disposable geodesic dome savant jeans faded modem.",
            "policy_shipping": "Bridge 8-bit soul-delay disposable dolphin convenience store fetishism shoes towards sunglasses girl camera saturation point vehicle courier.",
            "policy_refunds": "Nodality singularity shoes wristwatch savant ablative marketing 3D-printed convenience store corporation woman car artisanal RAF free-market physical.",
            "policy_additional": null,
            "policy_seller_info": null,
            "policy_updated_tsz": 1396363691,
            "vacation_autoreply": null,
            "url": "https:\/\/www.etsy.com\/shop\/AnEtsyShop?utm_source=etsylittlehelper&utm_medium=api&utm_campaign=api",
            "image_url_760x100": "https:\/\/img0.etsystatic.com\/033\/0\/3333333\/iusb_760x100.13409064_z8j1.jpg",
            "num_favorers": 55,
            "languages": ["en-US"],
            "upcoming_local_event_id": null
        },
            "shop_id": 4444444,
            "shop_name": "AnotherEtsyShopOfMine",
            "user_id": 55555555,
            "creation_tsz": 1393407522,
            "title": "Denim nodal point market DIY saturation",
            "announcement": "San Francisco geodesic rain knife office-ware concrete j-pop fluidity-space range-rover tanto free-market dead. Knife 3D-printed faded sunglasses cartel wristwatch hacker pen kanji sensory decay garage singularity.",
            "currency_code": "EUR",
            "is_vacation": false,
            "vacation_message": "Be back soon",
            "sale_message": "Corrupted smart-bridge gang rebar youtube spook pre-futurity carbon.",
            "digital_sale_message": null,
            "last_updated_tsz": 1427289394,
            "listing_active_count": 86,
            "login_name": "johndoe",
            "accepts_custom_requests": false,
            "policy_welcome": "Render-farm tube Tokyo A.I. gang Chiba disposable geodesic dome savant jeans faded modem.",
            "policy_shipping": "Bridge 8-bit soul-delay disposable dolphin convenience store fetishism shoes towards sunglasses girl camera saturation point vehicle courier.",
            "policy_refunds": "Nodality singularity shoes wristwatch savant ablative marketing 3D-printed convenience store corporation woman car artisanal RAF free-market physical.",
            "policy_additional": null,
            "policy_seller_info": null,
            "policy_updated_tsz": 1396363691,
            "vacation_autoreply": null,
            "url": "https:\/\/www.etsy.com\/shop\/AnotherEtsyShopOfMine?utm_source=etsylittlehelper&utm_medium=api&utm_campaign=api",
            "image_url_760x100": "https:\/\/img0.etsystatic.com\/033\/0\/4444444\/iusb_760x100.13409064_z8j1.jpg",
            "num_favorers": 55,
            "languages": ["en-US"],
            "upcoming_local_event_id": null
        }
    ],
    "params": {
        "user_id": "johndoe",
        "limit": 25,
        "offset": 0,
        "page": null
    },
    "type": "Shop",
    "pagination": {
        "effective_limit": 25,
        "effective_offset": 0,
        "next_offset": null,
        "effective_page": 1,
        "next_page": null
    }
}

I will not list the shop listings request result for the sake of brevity; now that a request result is in my hands I can use it to create a mocking API server component.

Next

I will be looking into the possibilities Codeception offers in terms of Helpers to have my testing in place.