npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kma/escapia-wrap

v1.7.0

Published

Wrapper for the Home Away Rental Agency API to easily connect web-based applications and properties.

Downloads

16

Readme

Escapia-Wrap

Escapia wrap is a publicly published SDK wrapper for the Escapia Rentals HSAPI v10 (https://hsapi.escapia.com/dragomanadapter/docs). This package expects the properties to already be syndicated with a local database and does not contain methods for retrieving properties.

Installation

Install the dependencies and devDependencies and start the server.

$ npm install @kma/escapia-wrap --save

Usage

The methods are implemented in that the response will feed the following method. For HSAPI object specifications, please see the HSAPI Swagger documentation. The intended workflow is authenticate > create a renter > generate quote > make reservation

Authenticating and obtaining temporary API Token

/**
* @param {string} clientID
* @param {string} clientSecret
* @param {string} pmcid
* @returns {boolean}
*/
let esc = new Escapia.Escapia()
let connected = await esc.authenticate(client, secret, pmcid)

Fetch Non-Availability Dates

/**
* @param {string} unitId
* @returns {Promise<Array<object>>}
*/
let esc = new Escapia.Escapia()
let connected = await esc.authenticate(client, secret, pmcid)

if(connected) {   
    let response = await esc.UnitAvailability("123456")
    if(Array.isArray(response) && response.length > 0)
        //Move to creating a renter
}

Create a Renter

/**
* @param {Guest} guest
* @param {boolean} isPrimaryGuest
* @param {boolean} isVIP
* @param {boolean} isWarn
* @param {string} notes
* @returns {Promis<object>}
*/
let guest = {
    firstName: "Fake",
    lastName: "Account",
    addresses: [{
        street1: "161 Good Morning St",
        city: "Port St Joe",
        state: "FL",
        zip: "32456",
        pmcid: pmcid,
        country: "US"
    }],
    phones: [{
        areaCode: "850",
        number: "807.4038",
        phoneContactTypeId: 0
    }],
    emails: [{
        address: "[email protected]",
        emailContactTypeId: 0 
    }]
}
let esc = new Escapia.Escapia()
let connected = await esc.authenticate(client, secret, pmcid)

if(connected) {    
    let response = await esc.UnitAvailability("123456")
    if(Array.isArray(response) && response.length > 0) {
        let renter = await esc.AddGuest(guest, isPrimaryGuest, isVIP, isWARN, "FakeAccount")
        if(guest.hasOwnProperty('nativePMSID'))
            //Move to generating a quote
    }
}

Generate a Quote

/**
* @param {string} startDate in YYYY-MM-DD format
* @param {string} endDate in YYYY-MM-DD format
* @param {number} numAdults > 0
* @param {number} numKids >= 0
* @param {string} pmsID property id in NNNNNN format
* @param {string} reservationType accepted values are renter,owner,guestofowner,travelagent,ownerreferral,complimentary,group,longterm
* @returns {Promise<object>}
*/
let esc = new Escapia.Escapia()
let connected = await esc.authenticate(client, secret, pmcid)

if(connected) {    
    let response = await esc.UnitAvailability("123456")
    
    if(Array.isArray(response) && response.length > 0) {
        let renter = await esc.AddGuest(guest, isPrimaryGuest, isVIP, isWARN, "FakeAccount")
        
        if(guest.hasOwnProperty('nativePMSID')) {
            quote = await esc.GenerateQuote(checkInDate, checkOutDate, numAdults, numKids, "123456", "renter")
            
            if(quote.hasOwnProperty('quoteSpecification'))  
                //Move to making a reservation
        }
    }
}

Making a Reservation

/**
* @param {Guest} guest
* @param {QuoteRequest} quote
* @returns {Promise<object>}
*/
let esc = new Escapia.Escapia()
let connected = await esc.authenticate(client, secret, pmcid)

if(connected) {    
    let response = await esc.UnitAvailability("123456")
    
    if(Array.isArray(response) && response.length > 0) {
        let renter = await esc.AddGuest(guest, isPrimaryGuest, isVIP, isWARN, "FakeAccount")
        
        if(guest.hasOwnProperty('nativePMSID')) {
            quote = await esc.GenerateQuote(checkInDate, checkOutDate, numAdults, numKids, "123456", "renter")
            
            if(quote.hasOwnProperty('quoteSpecification')) {
                let reservation = await esc.MakeReservation(renter, quote.quoteSpecification)
                
                if(reservation.hasOwnProperty('reservationNumber'))
                    //Success move to implementing your own payment solution
            } 
        }
    }
}

Development

Escapia-wrap is in the beginning stages of development with endpoints being added as needed.

License

ISC License

Copyright (c) 2019, Kerigan Marketing Associates

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.