New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

classy-pay-client

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classy-pay-client

Client for Classy Pay.

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
decreased by-24.24%
Maintainers
4
Weekly downloads
 
Created
Source

classy-pay-client

Simple client for Classy Pay.

installation

$ yarn install classy-pay-client

usage

PayClient.request(appId, method, resource, payload, params, callback)

const PayClient = require('classy-pay-client')({
  apiUrl: 'https://pay.classy.org',
  timeout: 10000,
  token: 'YOUR_TOKEN'
  secret: 'YOUR_SECRET'
});

PayClient.get(0, '/transaction/1', (error, result) => {
  if (error) {
    console.log(error);
  } else {
    console.log(result);
  }
});

PayClient.request(0, 'GET', '/transaction/1', null, null, (error, result) => {
  if (error) {
    console.log(error);
  } else {
    console.log(result);
  }
});


Functions

getHeaders(context, method, resource, payload)Object

Get all the necessary headers for the request.

getQs(appId, params)Object

Build the request query.

getOptions(context, appId, method, resource, payload, params)Object

Get the request options.

getResult(error, response, body)Object

Get the response for http request.

request(context, appId, method, resource, payload, params, callback)

A general Pay request.

getMax(context, appId, resource)Number

Retrieve the total number of objects for the resource.

getAll(context, appId, resource, max, collection)Promise

Get all the objects for a resource.

forList(context, appId, resource, callback)

Get all objects.

forObject(context, appId, method, resource, body, callback)

Get an object.

list(context, appId, resource, callback)Array

Get a list of objects for a resource.

get(context, appId, resource, callback)Object

Get an object given a resource.

post(context, appId, resource, object, callback)Object

Create an object at a resource.

put(context, appId, resource, object, callback)Object

Update an object at a resource.

del(context, appId, resource, callback)Object

Remove an object at a resource.

getHeaders(context, method, resource, payload) ⇒ Object

Get all the necessary headers for the request.

Kind: global function
Returns: Object - the headers objects

ParamTypeDescription
contextObjectthe request context
methodStringthe HTTP method for the request
resourceStringthe resource being requested
payloadObjectthe body of the request

getQs(appId, params) ⇒ Object

Build the request query.

Kind: global function
Returns: Object - params for request

ParamTypeDescription
appIdNumberthe pay application id
paramsObjectparams passed by client user

getOptions(context, appId, method, resource, payload, params) ⇒ Object

Get the request options.

Kind: global function
Returns: Object - the options for the request

ParamTypeDescription
contextObjectthe request context
appIdNumberthe pay application id
methodStringthe http method
resourceStringthe resource for the request
payloadObjectthe body of the request
paramsObjectthe params provided by the caller

getResult(error, response, body) ⇒ Object

Get the response for http request.

Kind: global function
Returns: Object - a well formed response object

ParamTypeDescription
errorObjectthe error
responseObjectthe http response
bodyObjectthe body of the response

request(context, appId, method, resource, payload, params, callback)

A general Pay request.

Kind: global function

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
methodStringthe http method
resourceStringthe pay resource
payloadObjectthe payload for the request
paramsObjectthe parameters for the request
callbackMethoda callback

getMax(context, appId, resource) ⇒ Number

Retrieve the total number of objects for the resource.

Kind: global function
Returns: Number - the total number of objects for the resource

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource

getAll(context, appId, resource, max, collection) ⇒ Promise

Get all the objects for a resource.

Kind: global function
Returns: Promise - a promise when resolved populates the collection

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
maxNumbertotal objects to retrieve
collectionArraythe collection to add objects to

forList(context, appId, resource, callback)

Get all objects.

Kind: global function

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
callbackfunctionthe callback

forObject(context, appId, method, resource, body, callback)

Get an object.

Kind: global function

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
methodStringthe http method
resourceStringthe pay resource
bodyObjectthe body of the request
callbackfunctionthe callback

list(context, appId, resource, callback) ⇒ Array

Get a list of objects for a resource.

Kind: global function
Returns: Array - an array of objects

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
callbackfunctionthe callback

get(context, appId, resource, callback) ⇒ Object

Get an object given a resource.

Kind: global function
Returns: Object - an object

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
callbackfunctionthe callback

post(context, appId, resource, object, callback) ⇒ Object

Create an object at a resource.

Kind: global function
Returns: Object - the created object

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
objectObjectthe object to create
callbackfunctionthe callback

put(context, appId, resource, object, callback) ⇒ Object

Update an object at a resource.

Kind: global function
Returns: Object - the updated object

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
objectObjectthe updated object
callbackfunctionthe callback

del(context, appId, resource, callback) ⇒ Object

Remove an object at a resource.

Kind: global function
Returns: Object - the removed object

ParamTypeDescription
contextObjectthe context for the request
appIdNumberthe pay application id
resourceStringthe pay resource
callbackfunctionthe callback

Keywords

FAQs

Package last updated on 02 May 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc