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

whitelabelmachinename-ruby-sdk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whitelabelmachinename-ruby-sdk

  • 3.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

WhiteLabelName Ruby Library

The WhiteLabelName Ruby library wraps around the WhiteLabelName API. This library facilitates your interaction with various services such as transactions, accounts, and subscriptions.

Documentation

WhiteLabelName Web Service API

Requirements

  • Ruby 2.2+

Installation

$ gem install whitelabelmachinename-ruby-sdk

Usage

The library needs to be configured with your account's space id, user id, and secret key which are available in your WhiteLabelName account dashboard. Set space_id, user_id, and api_secret to their values:

Configuring a Service

require 'whitelabelmachinename-ruby-sdk'

space_id = 405
app_user_id = 512
app_user_key = "FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ="

WhiteLabelMachineName.configure do |config|
  config.user_id = app_user_id
  config.authentication_key = app_user_key
end

# TransactionService
transaction_service = WhiteLabelMachineName::TransactionService.new
# TransactionPaymentPageService
transaction_payment_page_service = WhiteLabelMachineName::TransactionPaymentPageService.new

To get stated with sending transactions you can review the example below:

require 'whitelabelmachinename-ruby-sdk'

space_id = 405
app_user_id = 512
app_user_key = "FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ="

WhiteLabelMachineName.configure do |config|
    config.user_id = app_user_id
    config.authentication_key = app_user_key
end

# TransactionService
transaction_service = WhiteLabelMachineName::TransactionService.new
# TransactionPaymentPageService
transaction_payment_page_service = WhiteLabelMachineName::TransactionPaymentPageService.new

transaction = WhiteLabelMachineName::TransactionCreate.new({
    billingAddress: WhiteLabelMachineName::AddressCreate.new({
        city: "City",
        country: "US",
        emailAddress: "billing@address.com",
        familyName: "Family",
        givenName: "Given",
        postCode: "98100",
        postalState: "WA",
        street: "Street"
    }),
    currency: 'EUR',
    customerEmailAddress: "test@example.com",
    customerPresence: WhiteLabelMachineName::CustomersPresence::VIRTUAL_PRESENT,
    failedUrl: "http://localhost/failure",
    invoiceMerchantReference: "order-1",
    language: "en_US",
    lineItems: [
        WhiteLabelMachineName::LineItemCreate.new({
            amountIncludingTax: 29.60,
            name: "Item 1",
            quantity: 1,
            shippingRequired: true,
            sku: "sku-1",
            taxes: [
                WhiteLabelMachineName::TaxCreate.new({
                    rate: 8,
                    title: "VAT"
                })
            ],
            type: WhiteLabelMachineName::LineItemType::PRODUCT,
            uniqueId: "unique-id-item-1",
        }),
        WhiteLabelMachineName::LineItemCreate.new({
            amountIncludingTax: 5.60,
            name: "Test Shipping",
            quantity: 1,
            shippingRequired: false,
            sku: "test-shipping",
            taxes: [
                WhiteLabelMachineName::TaxCreate.new({
                    rate: 8,
                    title: "VAT"
                })
            ],
            type: WhiteLabelMachineName::LineItemType::SHIPPING,
            uniqueId: "unique-id-shipping-1",
        }),
    ],
    merchantReference: "order-1",
    shippingAddress: WhiteLabelMachineName::AddressCreate.new({
        city: "City",
        country: "US",
        emailAddress: "shipping@address.com",
        familyName: "Family",
        givenName: "Given",
        postCode: "98100",
        postalState: "WA",
        street: "Street"
    }),
    shippingMethod: "Test Shipping",
    successUrl: "http://localhost/success"
})

transaction = transaction_service.create(space_id, transaction)
payment_page_url = transaction_payment_page_service.payment_page_url(space_id, transaction.id)
# redirect to payment_page_url

License

Please see the license file for more information.

FAQs

Package last updated on 01 Nov 2022

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