0.4.14 • Published 8 years ago

habitat-client-node v0.4.14

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

habitat-client-node

An axios-powered client wrapper for the Habitat API

Habitat Node wrapper

Getting Started

npm i habitat-client-node

or for meteor folks...

meteor npm install habitat-client-node

Prerequisites

You'll need an API Key - contact us at developers@tryhabitat.com to get started!

Initialize connection

  • Initialize client and login
const client = new Habitat({
  baseUrl: "https://sandbox.tryhabitat.com",
  apiKey: "YOUR_API_KEY"
});

//Returns a session token if it wasn't passed into constructor
client.login({
  email: "yourusername@tryhabitat.com",
  password: "password"
})
.then((token) => {
  //set token in localStorage, etc...
});

Send an order to dispatch

  client.create({
      sellerId: sellerId,
      thirdParty: false,
      deliveryAddress: address,
      deliveryInstructions: instructions,
      customer: { phone, name },
      DaaSType: type
  })

Transaction lifecycle methods

  • Call transaction lifecycle methods, super easy and all return a promise.
  //accept an order (Admin / Vendor)

  client.accept(orderId).then((order) => {

      //what would be helpful to return here?

  })

  //assign a runner (Admin / Vendor)

  client.assign(orderId, {
     runnerId: runnerId
  }).then((order) => {

     //what would be helpful to return here?

  })

  //pickup an order (Admin / Runner)
  client.pickup(orderId).then((order) => {

      //what would be helpful to return here?

  })

  //dropoff an order (Admin / Runner)

  client.dropoff(orderId, {
    tip: 4.20,
    receiptUrl: https://placekitten.com/50/50
  }).then((order) => {

      //what would be helpful to return here?

   })

Built With

  • Axios - Promise-based HTTP client

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

Authors

  • Mike Paszkiewicz - Initial work - MikeP

License

This project is licensed under the MIT License - see the LICENSE.md file for details

0.4.14

8 years ago

0.4.13

8 years ago

0.4.12

8 years ago

0.4.11

8 years ago

0.4.10

8 years ago

0.4.9

8 years ago

0.4.82

8 years ago

0.4.81

8 years ago

0.4.8

8 years ago

0.4.7

8 years ago

0.4.41

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.1

8 years ago

0.2.25

8 years ago

0.3.0

8 years ago

0.2.24

8 years ago

0.2.23

8 years ago

0.2.22

8 years ago

0.2.21

8 years ago

0.2.20

8 years ago

0.2.19

8 years ago

0.2.18

8 years ago

0.2.17

8 years ago

0.2.16

8 years ago

0.2.15

8 years ago

0.2.14

8 years ago

0.2.13

8 years ago

0.2.12

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago