项目作者: bennymeg

项目描述 :
An API for Israel postal service
高级语言: TypeScript
项目地址: git://github.com/bennymeg/IsraelPostalServiceAPI.git
创建时间: 2018-10-13T17:52:52Z
项目社区:https://github.com/bennymeg/IsraelPostalServiceAPI

开源协议:Apache License 2.0

下载








# Israel Postal Service API
An API for Israel postal service - query shipment price easily.
Supports both NodeJS and browser environments.

licence
npm version
Dependencies status
Documentation





Installation

  1. npm install --save israel-postal-service-api

Usage

Import library:

  1. import { IPS, Options } from 'israel-postal-service-api';

Define Package Characteristics:

  1. // define package shipment characteristics
  2. let weightInGrams = 20;
  3. let serviceType = Options.AbroadMailOptions.LETTER.shipmentType;
  4. let serviceSubtype = Options.AbroadMailOptions.LETTER.shipmentSubtypes.regular;
  5. let option = serviceSubtype.options.signed;
  6. // initialize service
  7. let postalService = new IPS();

Calculate Shipping Rate:

  1. // calculate package shipping rate asynchronously
  2. let response = await postalService.calculateAbroadShippingRate(
  3. "Spain", weightInGrams, serviceType, serviceSubtype, option);
  4. // see {@class ResponseParser} API to discover the response structure
  5. console.log(response.getTotalPrice());

Supported Environments

  • 💻 Browser (including browserify / webpack based environments [such as Angular])
  • 🖥 Node.js

Documentation

Support

If you’re having any problem, please raise an issue on GitHub and we’ll be happy to help.

Contribute

Before submitting a pull request, please make sure that you include tests, and that jshint runs without any warnings: Download VSCode extension.

Test

Run the test suite by executing:

  1. $ npm test

Note:
This API was create as an open source service for makers and entrepreneurs.
This is not an official API for Israel Post service.

Author: Benny Megidish.