2017 © Pedro Peláez
 

library yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

image

radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  • Monday, January 22, 2018
  • by radowoj
  • Repository
  • 2 Watchers
  • 3 Stars
  • 23 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

yaah - Yet Another Allegro Helper :)

Scrutinizer Code Quality Code Coverage Build Status, (*1)

Simple client library for Allegro WebAPI., (*2)

Goals

  • Simplify basic auction operations (creating new auction, finishing, changing item quantity, retrieving log etc) - Helper class.
  • Avoid the necessity of sending defaults for every value type of every required field (fvalueString, fvalueInt, fvalueDate, fvalueAndSoOn...) - Auction class and its decorators.

Installation

Via composer, (*3)

$ composer require radowoj/yaah

Example 1 - new auction

For an example of a more programmer-friendly Auction interface, see yaah-mtg, (*4)

use Radowoj\Yaah\Auction;
use Radowoj\Yaah\Constants\AuctionTimespans;
use Radowoj\Yaah\Constants\AuctionFids;
use Radowoj\Yaah\Constants\SaleFormats;
use Radowoj\Yaah\Constants\ShippingPaidBy;
use Radowoj\Yaah\Constants\PaymentForms;
use Radowoj\Yaah\HelperFactory\Factory;

$helper = (new Factory())->create([
    'apiKey'        => 'your-allegro-api-key',
    'login'         => 'your-allegro-login',
    'passwordHash'  => 'your-sha-256-hashed-and-then-base64-encoded-allegro-password',
    'countryCode'   => 'your-country-code',
    'isSandbox'     => 'true-if-you-intend-to-use-sandbox'
]);

$localId = 1;

$auction = new Auction([
    AuctionFids::FID_TITLE => 'Test auction',
    AuctionFids::FID_CATEGORY => 26319,
    AuctionFids::FID_TIMESPAN => AuctionTimespans::TIMESPAN_7_DAYS,
    AuctionFids::FID_QUANTITY => 1,
    AuctionFids::FID_BUY_NOW_PRICE => 10.00,
    AuctionFids::FID_COUNTRY => 1,
    AuctionFids::FID_REGION => 15,
    AuctionFids::FID_CITY => 'Poznan',
    AuctionFids::FID_SHIPPING_PAID_BY => ShippingPaidBy::SHIPPING_PAID_BY_BUYER,
    AuctionFids::FID_PAYMENT_FORMS => PaymentForms::PAYMENT_FORM_VAT_INVOICE,
    AuctionFids::FID_DESCRIPTION => 'Test auction description',
    AuctionFids::FID_POSTCODE => '12-345',
    AuctionFids::FID_SALE_FORMAT => SaleFormats::SALE_FORMAT_NON_SHOP,
    AuctionFids::FID_POST_PACKAGE_PRIORITY_PRICE => 11.00
]);

$auction->setPhotos([
    //array of (no more than 8) paths to photo files
]);

$allegroItemId = $helper->newAuction($auction, $localId);

echo "Created auction with itemId = {$allegroItemId}\n";

Example 2 - retrieving journal

require_once __DIR__ . '/../vendor/autoload.php';

require_once 'config.php';

use Radowoj\Yaah\HelperFactory\Factory;

try {
    $helper = (new Factory())->create(require('config.php'));

    $deals = $helper->getSiteJournalDeals();

    /**
     * Process journal entries - in this case echo details of every journal
     * item that creates a deal
     */
    array_map(function($deal){
        if ($deal->isTypeCreateDeal()) {
            echo "Deal {$deal->getId()} (itemId {$deal->getItemId()} - quantity {$deal->getQuantity()}) created at {$deal->getEventTime()}\n";
        }
    }, $deals);

} catch (Exception $e) {
    echo "Exception: {$e->getMessage()}\nFile: {$e->getFile()}; Line: {$e->getLine()}\n\n";
}

The Versions

22/01 2018

dev-master

9999999-dev https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

01/04 2017

v0.8.0

0.8.0.0 https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

01/04 2017

v0.8.0-rc

0.8.0.0-RC https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

26/03 2017

v0.7.0

0.7.0.0 https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

25/03 2017

v0.6.0

0.6.0.0 https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

14/03 2017

v0.5.0

0.5.0.0 https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

11/03 2017

v0.4.0

0.4.0.0 https://github.com/radowoj/yaah

Yet Another Allegro Helper - Allegro WebAPI client with helper to simplify communication

  Sources   Download

MIT

The Development Requires

by Radosław Wojtyczka

php webapi allegro

08/03 2017

v0.3.0

0.3.0.0

Yet Another Allegro Helper :)

  Sources   Download

MIT

The Development Requires

by Avatar radowoj

02/03 2017

v0.2.0

0.2.0.0

Yet Another Allegro Helper :)

  Sources   Download

MIT

The Development Requires

by Avatar radowoj

26/02 2017

v0.1.0

0.1.0.0

Yet Another Allegro Helper :)

  Sources   Download

MIT

by Avatar radowoj