Socket
Book a DemoInstallSign in
Socket

devdraft

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devdraft

1.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Devdraft Ruby SDK

A Ruby client library for the Devdraft Payment & Business Management API.

Installation

Add this line to your application's Gemfile:

gem 'devdraft', '~> 1.0.1'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install devdraft

Usage

Basic Setup

require 'devdraft'

# Configure the SDK
Devdraft.configure do |config|
  # Set your authentication headers (required for authenticated endpoints)
  config.default_headers = {
    'x-client-key' => 'YOUR_CLIENT_KEY',
    'x-secret-key' => 'YOUR_SECRET_KEY'
  }
  
  # Optional: Set a custom base URL if needed
  # config.base_url = 'https://api.devdraft.com'
  
  # Optional: Enable debug logging
  config.debugging = true
end

You can generate your client key and secret key from the Devdraft Console under App Settings.

Examples

Basic Setup

require 'devdraft'

# Configure the SDK
Devdraft.configure do |config|
  # Set your authentication headers (required for authenticated endpoints)
  config.default_headers = {
    'x-client-key' => 'YOUR_CLIENT_KEY',
    'x-secret-key' => 'YOUR_SECRET_KEY'
  }
  
  # Optional: Set a custom base URL if needed
  # config.base_url = 'https://api.devdraft.com'
  
  # Optional: Enable debug logging
  config.debugging = true
end

You can generate your client key and secret key from the Devdraft Console under App Settings.

Create a Customer

api_instance = Devdraft::CustomersApi.new

# Create a new customer
customer_data = Devdraft::CreateCustomerDto.new(
  email: 'customer@example.com',
  name: 'John Doe',
  status: 'active'
)

begin
  result = api_instance.customer_controller_create(customer_data)
  puts "Customer created: #{result.inspect}"
rescue Devdraft::ApiError => e
  puts "Error creating customer: #{e.response_body}"
end
api_instance = Devdraft::PaymentLinksApi.new

# Create a payment link for a product
payment_link = Devdraft::CreatePaymentLinkDto.new(
  amount: 99.99,
  currency: 'USD',
  description: 'Premium Subscription',
  expires_at: (Time.now + 7.days).iso8601,  # Expires in 7 days
  products: [
    Devdraft::PaymentLinkProductDto.new(
      name: 'Premium Plan',
      quantity: 1,
      price: 99.99
    )
  ]
)

begin
  result = api_instance.payment_links_controller_create(payment_link)
  puts "Payment link created: #{result.inspect}"
rescue Devdraft::ApiError => e
  puts "Error creating payment link: #{e.response_body}"
end

Check Balance

api_instance = Devdraft::AppBalancesApi.new

begin
  # Get all balances
  balances = api_instance.balance_controller_get_all_balances
  puts "All balances: #{balances.inspect}"
  
  # Get specific currency balance
  usdc_balance = api_instance.balance_controller_get_usdc_balance
  puts "USDC balance: #{usdc_balance.inspect}"
rescue Devdraft::ApiError => e
  puts "Error checking balance: #{e.response_body}"
end

Create a Webhook

api_instance = Devdraft::WebhooksApi.new

webhook = Devdraft::CreateWebhookDto.new(
  url: 'https://your-domain.com/webhooks',
  events: ['payment.created', 'payment.completed'],
  description: 'Payment notifications'
)

begin
  result = api_instance.webhook_controller_create(webhook)
  puts "Webhook created: #{result.inspect}"
rescue Devdraft::ApiError => e
  puts "Error creating webhook: #{e.response_body}"
end

Available APIs

The SDK provides access to the following APIs:

  • APIHealthApi: Health check endpoints
  • AppBalancesApi: Balance management
  • CustomersApi: Customer management
  • ExchangeRatesApi: Exchange rate information
  • InvoicesApi: Invoice management
  • LiquidationAddressesApi: Liquidation address management
  • PaymentIntentsApi: Payment intent management
  • PaymentLinksApi: Payment link management
  • ProductsApi: Product management
  • TaxesApi: Tax management
  • TestPaymentsApi: Test payment endpoints
  • TransfersApi: Transfer management
  • WalletsApi: Wallet management
  • WebhooksApi: Webhook management

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the Unlicense.

Documentation for API Endpoints

All URIs are relative to https://api.devdraft.ai

ClassMethodHTTP requestDescription
DevDraftAI::APIHealthApihealth_controller_check_v0GET /api/v0/healthAuthenticated health check endpoint
DevDraftAI::APIHealthApihealth_controller_public_health_check_v0GET /api/v0/health/publicPublic health check endpoint
DevDraftAI::AppBalancesApibalance_controller_get_all_balancesGET /api/v0/balanceGet all stablecoin balances for an app
DevDraftAI::AppBalancesApibalance_controller_get_eurc_balanceGET /api/v0/balance/eurcGet EURC balance for an app
DevDraftAI::AppBalancesApibalance_controller_get_usdc_balanceGET /api/v0/balance/usdcGet USDC balance for an app
DevDraftAI::CustomersApicustomer_controller_createPOST /api/v0/customersCreate a new customer
DevDraftAI::CustomersApicustomer_controller_find_allGET /api/v0/customersGet all customers with filters
DevDraftAI::CustomersApicustomer_controller_find_oneGET /api/v0/customers/{id}Get a customer by ID
DevDraftAI::CustomersApicustomer_controller_updatePATCH /api/v0/customers/{id}Update a customer
DevDraftAI::ExchangeRatesApiexchange_rate_controller_get_eurto_usd_rateGET /api/v0/exchange-rate/eur-to-usdGet EUR to USD exchange rate
DevDraftAI::ExchangeRatesApiexchange_rate_controller_get_exchange_rateGET /api/v0/exchange-rateGet exchange rate between specified currencies
DevDraftAI::ExchangeRatesApiexchange_rate_controller_get_usdto_eur_rateGET /api/v0/exchange-rate/usd-to-eurGet USD to EUR exchange rate
DevDraftAI::InvoicesApiinvoice_controller_createPOST /api/v0/invoicesCreate a new invoice
DevDraftAI::InvoicesApiinvoice_controller_find_allGET /api/v0/invoicesGet all invoices
DevDraftAI::InvoicesApiinvoice_controller_find_oneGET /api/v0/invoices/{id}Get an invoice by ID
DevDraftAI::InvoicesApiinvoice_controller_updatePUT /api/v0/invoices/{id}Update an invoice
DevDraftAI::LiquidationAddressesApiliquidation_address_controller_create_liquidation_addressPOST /api/v0/customers/{customerId}/liquidation_addressesCreate a new liquidation address for a customer
DevDraftAI::LiquidationAddressesApiliquidation_address_controller_get_liquidation_addressGET /api/v0/customers/{customerId}/liquidation_addresses/{liquidationAddressId}Get a specific liquidation address
DevDraftAI::LiquidationAddressesApiliquidation_address_controller_get_liquidation_addressesGET /api/v0/customers/{customerId}/liquidation_addressesGet all liquidation addresses for a customer
DevDraftAI::PaymentIntentsApipayment_intent_controller_create_bank_payment_intentPOST /api/v0/payment-intents/bankCreate a bank payment intent
DevDraftAI::PaymentIntentsApipayment_intent_controller_create_stable_payment_intentPOST /api/v0/payment-intents/stablecoinCreate a stable payment intent
DevDraftAI::PaymentLinksApipayment_links_controller_createPOST /api/v0/payment-linksCreate a new payment link
DevDraftAI::PaymentLinksApipayment_links_controller_find_allGET /api/v0/payment-linksGet all payment links
DevDraftAI::PaymentLinksApipayment_links_controller_find_oneGET /api/v0/payment-links/{id}Get a payment link by ID
DevDraftAI::PaymentLinksApipayment_links_controller_updatePUT /api/v0/payment-links/{id}Update a payment link
DevDraftAI::ProductsApiproduct_controller_createPOST /api/v0/productsCreate a new product
DevDraftAI::ProductsApiproduct_controller_find_allGET /api/v0/productsGet all products
DevDraftAI::ProductsApiproduct_controller_find_oneGET /api/v0/products/{id}Get a product by ID
DevDraftAI::ProductsApiproduct_controller_removeDELETE /api/v0/products/{id}Delete a product
DevDraftAI::ProductsApiproduct_controller_updatePUT /api/v0/products/{id}Update a product
DevDraftAI::ProductsApiproduct_controller_upload_imagePOST /api/v0/products/{id}/imagesUpload images for a product
DevDraftAI::TaxesApitax_controller_createPOST /api/v0/taxesCreate a new tax
DevDraftAI::TaxesApitax_controller_find_allGET /api/v0/taxesGet all taxes
DevDraftAI::TaxesApitax_controller_find_oneGET /api/v0/taxes/{id}Get a tax by ID
DevDraftAI::TaxesApitax_controller_removeDELETE /api/v0/taxes/{id}Delete a tax
DevDraftAI::TaxesApitax_controller_updatePUT /api/v0/taxes/{id}Update a tax
DevDraftAI::TestPaymentsApitest_payment_controller_create_payment_v0POST /api/v0/test-paymentProcess a test payment
DevDraftAI::TestPaymentsApitest_payment_controller_get_payment_v0GET /api/v0/test-payment/{id}Get payment details by ID
DevDraftAI::TestPaymentsApitest_payment_controller_refund_payment_v0POST /api/v0/test-payment/{id}/refundRefund a payment
DevDraftAI::TransfersApitransfer_controller_create_direct_bank_transferPOST /api/v0/transfers/direct-bankCreate a direct bank transfer
DevDraftAI::TransfersApitransfer_controller_create_direct_wallet_transferPOST /api/v0/transfers/direct-walletCreate a direct wallet transfer
DevDraftAI::TransfersApitransfer_controller_create_stablecoin_conversionPOST /api/v0/transfers/stablecoin-conversionCreate a stablecoin conversion
DevDraftAI::WalletsApiwallet_controller_get_walletsGET /api/v0/walletsGet wallets for an app
DevDraftAI::WebhooksApiwebhook_controller_createPOST /api/v0/webhooksCreate a new webhook
DevDraftAI::WebhooksApiwebhook_controller_find_allGET /api/v0/webhooksGet all webhooks
DevDraftAI::WebhooksApiwebhook_controller_find_oneGET /api/v0/webhooks/{id}Get a webhook by id
DevDraftAI::WebhooksApiwebhook_controller_removeDELETE /api/v0/webhooks/{id}Delete a webhook
DevDraftAI::WebhooksApiwebhook_controller_updatePATCH /api/v0/webhooks/{id}Update a webhook

Documentation for Models

Documentation for Authorization

idempotency-key

  • Type: API key
  • API key parameter name: idempotency-key
  • Location: HTTP header

x-client-key

  • Type: API key
  • API key parameter name: x-client-key
  • Location: HTTP header

x-client-secret

  • Type: API key
  • API key parameter name: x-client-secret
  • Location: HTTP header

FAQs

Package last updated on 17 Jun 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.