2017 © Pedro Peláez
 

library client

A client for the WebwinkelKeur API

image

webwinkelkeur/client

A client for the WebwinkelKeur API

  • Friday, May 25, 2018
  • by kiboit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 33 % Grown

The README.md

WebwinkelKeur API Client

This is a web client for the WebwinkelKeur API., (*1)

The documentation of the API is available at https://dashboard.webwinkelkeur.nl/pages/api., (*2)

Should you experience any issues with the API client, feel free to open a GitHub issue., (*3)

Installation

You can use composer to install the API client into your project:, (*4)

composer require webwinkelkeur/client

Usage

To send requests to the API, you need your WebwinkelKeur ID and authentication token., (*5)

use WebwinkelKeur\Client;
use WebwinkelKeur\Client\Request;

$webwinkelKeurClient = new Client($id, $authToken);

Sending invitations

$invitation = new Request\Invitation();
$invitation
    ->setCustomerName('John Doe')
    ->setEmailAddress('john.doe@example.com')
    ->setPhoneNumbers(['+1.2024561111', '+1.2024561414'])
    ->setOrderNumber(184553)
    ->setOrderTotal(23.55);

try {
    $webwinkelKeurClient->sendInvitation($invitation);
    echo 'Success!';
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

Retrieving sent invitations

try {
    foreach ($webwinkelKeurClient->getSentInvitations() as $sentInvitation) {
        echo 'Invitation for order ' . $sentInvitation->getOrderNumber()
            . ' was sent on ' . $sentInvitation->getCreatedAt()->format('r')
            . ' to ' . $sentInvitation->getEmail() . "\n";
    }
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

Retrieving ratings

try {
    foreach ($webwinkelKeurClient->getRatings() as $rating) {
        echo $rating->getName() . ' says "' . $rating->getComment() . "\"\n";
    }
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

Retrieving ratings summary

try {
    $ratingsSummary = $webwinkelKeurClient->getRatingsSummary();
    echo 'The average rating is ' . $ratingsSummary->getRatingAverage()
        . ' out of ' . $ratingsSummary->getAmount() . " ratings.";
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

Retrieving web shop details

try {
    $webshop = $webwinkelKeurClient->getWebshop();
    $address = $webshop->getAddress();
    echo $webshop->getName() . ' is located at '
        . $address->getNumber() . ' ' . $address->getStreet() . ', ' . $address->getCity();
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

Retrieving rich snippet

try {
    $richSnippet = $webwinkelKeurClient->getRichSnippet();
    echo $richSnippet;
} catch (Client\Exception $e) {
    echo $e->getMessage();
}

The Versions

25/05 2018

dev-master

9999999-dev

A client for the WebwinkelKeur API

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest client web service http client webwinkelkeur

09/05 2018

1.0

1.0.0.0

A client for the WebwinkelKeur API

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest client web service http client webwinkelkeur