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

reshuffle-fastspring-connector

v0.0.3

Published

Reshuffle connectors for FastSpring

Downloads

6

Readme

reshuffle-fastspring-connector

Code | npm | Code sample

npm install reshuffle-fastspring-connector

Reshuffle FastSpring Connector

This package contains a Resshufle connector to fastspring.com. It can be used to configure and manage online store and purchases, and privdes access to the full FastSpring API.

This example gets the product list from Fast Spring:

const { Reshuffle } = require('reshuffle')
const { FastSpringConnector } = require('reshuffle-fastspring-connector')

;(async () => {
  const app = new Reshuffle()
  const fs = new FastSpringConnector(app, {
    username: process.env.FASTSPRING_USERNAME,
    password: process.env.FASTSPRING_PASSWORD,
  })

  const products = await fs.getProductList()
  console.log(products)
})()

Table of Contents

Configuration Configuration options

Connector actions:

deleteProduct Delete a product

getLocalizedPrice Get price in a specific country

getProductInfo Get product information

getProductList Get a list of available products

updateProduct Create or update one product

updateProducts Create or update multiple products

updateSimpleProduct Simplified create/update action

REST:

DELETE Direct REST DELETE

GET Direct REST GET

POST Direct REST POST

Configuration options
const app = new Reshuffle()
const fastSpringConnector = new FastSpringConnector(app)

Connector actions

Delete Product action

Definition:

(
  productID: string,
) => void

Usage:

await fastSpringConnector.deleteProduct('my-product')

Delete a product from the store.

Get Localized Price action

Definition:

(
  productID: string,
  countryCode?: string, // optional
) => number

Usage:

const usd = await fastSpringConnector.getLocalizedPrice('my-product', 'US')

Get the price for a product in a specific country. If a price in local currency was not defined for the product, then the stored price is automaically converted into local currency.

Get Product Info action

Definition:

(
  productID: string,
) => Object

Usage:

const info = await fastSpringConnector.getProductInfo('my-product')

Get the full product information. See updateProduct below for details.

Get Product List action

Definition:

() => string[]

Usage:

const list = await fastSpringConnector.getProductist()

Get a list of product IDs for all the products in your store.

Update Product action

Definition:

(
  productID: string,
  info: Object,
) => void

Usage:

await fastSpringConnector.updateProduct('my-product', {
  display: {
    en: 'My Product',
  },
  pricing: {
    price: { USD: 3.14 },
  },
})

Create or update a product with a specified ID. A full description of the product information object can be found here.

Update is an additive operation, i.e. fields that are not included in the info object are not removed from the object record. Rather new fields are added and new values for exsiting fields are updated.

If no product with the specified ID exists, then a new object is created.

Update Products action

Definition:

(
  info: Object[],
) => void

Usage:

await fastSpringConnector.updateProducts([
  { product: 'p1', display: { en: 'Product One' } },
  { product: 'p2', display: { en: 'Product Two' } },
])

Create or update multiple products using product info objects. A full description of the product information object can be found here.

Update Simple Product action

Definition:

(
  productID: string,
  englishDisplay: string,  // display name
  usd: number,             // price in USD
) => void

Usage:

await fastSpringConnector.updateProduct('my-product', 'My Product', 3.14)

A simplified interface for creating or updating product information. For full control over product info, use updateSimpleProduct above.

REST

DELETE action

Definition:

(
  path: string,
) => object | text

Usage:

const response = await fastSpringConnector.DELETE(`products/${id}`)

Send a DELETE request. Returns a JavaScript object for JSON responses or text string otherwise. Throws an exception if a non-2xx HTTP code is returned.

GET action

Definition:

(
  path: string,
) => object | text

Usage:

const response = await fastSpringConnector.GET(`products/${id}`)

Send a GET request. Returns a JavaScript object for JSON responses or text string otherwise. Throws an exception if a non-2xx HTTP code is returned.

POST action

Definition:

(
  path: string,
  body: object,
) => object | text

Usage:

const response = await fastSpringConnector.POST(
  'products',
  { products: productInfo },
)

Send a POST request. Returns a JavaScript object for JSON responses or text string otherwise. Throws an exception if a non-2xx HTTP code is returned.