Socket
Socket
Sign inDemoInstall

demand-bloc-quotes

Package Overview
Dependencies
494
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    demand-bloc-quotes

BLoC to work with Karhoo Quotes API


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
46.4 MB
Created
Weekly downloads
 

Changelog

Source

2.1.1 (2020-05-27)

  • demand-api: getApi - update api url creation (#45) (b172204), closes #45

Bug Fixes

  • add "main" into package.json (#51) (045755b)
  • change polling subscription complete handler (#56) (180c113)

Features

  • et-994 Add missing API calls (c6d42ea)

BREAKING CHANGES

  • Update api url creation in getApi of demand-api package

  • v1.0.0

Readme

Source
Karhoo logo

demand-bloc-quotes

BLoC to work with Karhoo Quotes API


License

⚠️ This package is work in progress and can not be used as an independent package.

Installation

npm i @karhoo/demand-bloc-quotes

Usage


import { getApi } from '@karhoo/demand-api'
import { QuotesBloc } from '@karhoo/demand-bloc-quotes'

const api = getApi({
  url: 'api',
  defaultRequestOptionsGetter: () => ({
    headers: {
      identifier: 'XXXX',
      referrer: 'https://example-referer.com/'
    }
  })
})

const quotesSearchParams = {
  originPlaceId: "ChIJpwBVsLIadkgRE767cq0HnXQ",
  destinationPlaceId: "ChIJmdRFlbIadkgRhYudNQm2yOc",
  localTimeOfPickup: "2020-05-20T12:00"
}

const quotesBloc = new QuotesBloc(api.quotesService)

quotesBloc.filters = {
  numOfLuggage: 2,
  numOfPassengers: 2,
}

quotesBloc.matchingQuotes.subscribe((data) => {
  // quotes that accepts 2 passengers and 2 bags
  console.log('Matching quotes', data)
})

quotesBloc.otherAvailibleQuotes.subscribe((data) => {
  // all other quotes that did not match filters
  console.log('Other quotes', data)
})

quotesBloc.loading.subscribe(isLoading => {
  console.log('isLoading', isLoading)
})

quotesBloc.quotesExpired.subscribe(() => {
  console.log('Quotes Expired')

  quotesBloc.refreshQuotes() // requests quotes with same search params
})

quotesBloc.requestQuotes(quotesSearchParams)

Keywords

FAQs

Last updated on 27 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc