Giter Site home page Giter Site logo

celdotro / marketplace_examples Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 344 KB

Examples for CEL.ro Marketplace API wrapper

License: MIT License

PHP 100.00%
marketplace-api-wrapper-examples marketplace-api-wrapper-doc cel-marketplace marketplace cel api-wrapper celdotro documentation examples php ro-marketplace

marketplace_examples's Introduction

CEL.ro: marketplace_examples

[RO] Exemple pentru folosirea API wrapper-ului marketplaceului
[EN] Examples for marketplace's API wrapper usage


[RO]

Despre

Acest proiect contine exemple ce pot fi folosite pentru intelegerea mai buna a API Wrapper-ului pentru CEL.ro Marketplace.
Pentru instructiunile generale legate de utilizarea wrapper-ului, va trebui sa consultati documentatia:

Setari principale

Rulati urmatoarea comanda in directorul principal

composer install

Structura fisierelor si directoarelor

  1. Fisierul "api_include.php" aflat la baza structurii include fisierul index al API-ului. De asemenea, contine o sectiune de comentarii in care sunt reluate problemele discutate in "Setari principale". iii. Acesta contine namespaceul si numele clasei de autentificare, precum si metoda statica ce trebuie folosita inainte de apelarea oricarei alte metode din API. Pentru a rula oricare dintre script-uri, va trebui sa inlocuiti numele de utilizator si parola cu cele aferente contului dumneavoastra. De asemenea, daca doriti sa utilizati serverul live, va trebui sa comentati linia de cod:
    celmarket\Config::setDemo();
  2. Fiecare director reprezinta o categorie de exemple: Products (Produse), Pages (Pagini), Orders (Comenzi), Invoices (Facturi), AWB
  3. Fiecare fisier este compus din 5 parti
    i. comentariu => pune la dispozitie o scurta descriere a exemplului (in RO si EN)
    ii. include => include api_include.php (este necesar numai pentru exemple)
    iii. use => contine namespaceul si numele clasei folosite din API
    iv. functie => contine instructiunile principale prin care API-ul poate fi folosit. De asemenea, parametrii functiei corespund intocmai celor ai metodei din API
          - instantierea obiectului
          - declararea unui bloc try-catch
          - apeleaza functia necesara si stocheaza valoarea returnata in variabila $response
          - printeaza valoarea returnata sau foloseste echo pentru mesajul de eroare
    vi. exemplu => apeleaza functia cu date aleatorii. In functie de datele pe care le aveti deja, exista posibilitatea ca argumentele functiei sa nu duca la returnarea de valori relevante, de aceea ar trebui sa le schimbati in consecinta.

Rulare script

Exemplu

php /CALE_CATRE_PROIECT/Orders/1.getOrdersSummary.php

Index

In folderul principal, fisierul index.php genereaza automat un cuprins al tuturor directoarelor si fisierelor relevante pentru exemple. Acesta poate fi folosit ca referinta, dar este incurajata rularea din linia de comanda si editarea manuala a fisierelor, proiectul fiind conceput pentru a servi intelegerii modului de utilizare al API wrapper-ului de catre programatori, nu pentru a demonstra facilitatile API-ului.

  1. Accesare prin intermediul unui server web
    http://****/marketplace_examples/index.php
    
  2. Accesare prin intermediul liniei de comanda
    php index.php

Contact

dp [_ AT _] cel.ro


[EN]

About

This project contains examples that can be used for a better understanding of CEL.ro Marketplace API Wrapper.
For general instructions about the wrapper's usage, read the documentation.

Main settings

Run the following command in the main folder

composer install

Files and folders structure

  1. The file "api_include.php" situated in the path root includes the path for the API index file. It also provides a comment section about the issues presented in "Main settings". It contains the namespace and class name used in the authentication process, and the static method that must be called before calling any other method of the API. In order to use any script you must replace the user name and password with the supplied credentials. Also, if you decide to use the live server, you should comment out the line below
    celmarket\Config::setDemo();
  2. Each folder represents a category of examples: Products, Pages, Orders, Invoices and AWBs
  3. Each file has 5 parts
    i. comment => provides a short description of the example (in RO and EN)
    ii. include => includes api_include.php (this is only necessary for the example to work)
    iii. use => contains the used namespace and class from the API
    iv. function => contains the main logic of the API usage. Also, parameters map perfectly with the API method.
          - instantiate object
          - declare try-catch block
          - call the appropriate function and store the returned value in the $response variable
          - print the returned value or echo the error message
    vi. example => calls the function with random data. Depending on your specific case, the provided arguments may not render relevant return values, therefore you should change them accordingly.

Run script

Example

php /PATH_TO_PROJECT/Orders/1.getOrdersSummary.php

Index

The file index.php from the main folder automatically generates a contents of all relevant folders and files needed for examples. This can be used as a reference point, but running the scripts from command line and manually editing files are highly recommended because this project's purpose is to help programmers with the process of understanding of how the API wrapper works and not to be a showcase of the API.

  1. Access through a web server
    http://****/marketplace_examples/index.php
    
  2. Access through the command line
    php index.php

Contact

dp [_ AT _] cel.ro

marketplace_examples's People

Contributors

celdotro avatar fredtux avatar xiopt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

marketplace_examples's Issues

nu functioneaza getCategories.php

Am folosit exemplul acesta :

marketplace_examples/Products/1.getCategories.php

Si primesc ca raspuns:

stdClass Object  
(  
    [message] => A intervenit o eroare. Departamentul tehnic a fost notificat.  
    [error] => 1  
    [tokenStatus] => 1  
    [params] =>   
)

Singura modificare a fost un update la packageul marketplace la versiunea 1.17.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.