0.0.8 • Published 9 years ago

emspost v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

emspost

This is a NodeJS library for EMS Russian Post API. Get more about the API.

Install

npm install emspost --save

Example

var emspost = require('emspost');
emspost.echo().then(function (result) {
    if (result) {
        console.log('service is available');
    } else {
        console.log('service isn\'t available');
    }
}).catch(function (error) {
    console.log('something went wrong...');
})

API Methods

Get countries

Example:

emspost.getCountries().then(function (result) {
    console.log(result);
})

Result:

[
    ...
    {name: 'РОССИЯ', code: 'RU'},
    ...
]

Get regions

Example:

emspost.getRegions().then(function (result) {
    console.log("getRegions", result);
})

Result:

[
    ...
    {name: 'АДЫГЕЯ РЕСПУБЛИКА', code: 'region--respublika-adygeja'},
    ...
]

Get cities

Example:

emspost.getCities().then(function (result) {
    console.log("getCities", result);
})

Result:

[
    ...
    {name: 'АБАКАН', code: 'city--abakan'},
    ...
]

Get max weight

Example:

emspost.getMaxWeight().then(function (result) {
    console.log("getMaxWeight", result);
})

Calculate delivery price

Method has one argument CalculateProperty that contains the following properties (see more about these properties):

{
    from?:string, 
    to:string, 
    weight:number,
    type:string
}

Example:

emspost.calculate({from: "city--moskva", to: "city--murmansk", weight: 1})
    .then(function (result) {
        console.log('calculate', result);
    })

Result:

{
    price: 680,
    period: {
        max: 3,
        min: 2
    }
}
0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago