Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stigg-api-client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stigg-api-client

  • 2.233.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Stigg::Client

This Ruby gem provides a wrapper to Stigg's GraphQL API based on the operations that are in use by the Stigg's Node.js SDK. It leverages the graphlient library under the hood, and utilizes the Graphlient::Client class to execute the API requests.

Documentation

See https://docs.stigg.io/docs/ruby-sdk

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add stigg-api-client

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install stigg-api-client

Usage

Initialize the client:


require("stigg")

api_key = ENV["STIGG_SERVER_API_KEY"]

client = Stigg.create_client(api_key)

Provision a customer


require("stigg")

api_key = ENV["STIGG_SERVER_API_KEY"]

client = Stigg.create_client(api_key)

resp = client.request(Stigg::Mutation::ProvisionCustomer, {
    "input": {
        "refId": "customer-id",
        "name": "Acme",
        "email": "hello@acme.com",
        "couponRefId": "coupon-id",
        "billingInformation": {
            "language": "en",
            "timezone": "America/New_York",
            "billingAddress": {
                "country": "US",
                "city": "New York",
                "state": "NY",
                "addressLine1": "123 Main Street",
                "addressLine2": "Apt. 1",
                "phoneNumber": "+1 212-499-5321",
                "postalCode": "10164"
            },
            "shippingAddress": {
                "country": "US",
                "city": "New York",
                "state": "NY",
                "addressLine1": "123 Main Street",
                "addressLine2": "Apt. 1",
                "phoneNumber": "+1 212-499-5321",
                "postalCode": "10164"
            }
        },
        "additionalMetaData": {
            "key": "value"
        },
        "subscriptionParams": {
            "planId": "plan-revvenu-basic"
        }
    }
})

p resp.data.provision_customer.customer.name

Get a customer by ID



require("stigg")

api_key = ENV["STIGG_SERVER_API_KEY"]

client = Stigg.create_client(api_key)

resp = client.request(Stigg::Query::GetCustomerById, { 'customerId': 'customer-id' })
customer_edge = resp.data.customers.edges[0]
if customer_edge
  customer = customer_edge.node
  p customer.name
else
  p 'Customer not found'
end

FAQs

Package last updated on 15 Dec 2024

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