Skip to main content

Frameworks

Ruby on Rails — Scell.io integration

No Ruby SDK — Faraday + service object

Scell.io does NOT publish an official Ruby SDK. In Rails, create a service object (`app/services/scell_client.rb`) wrapping `Faraday` (or `HTTParty`) with `X-API-Key` header. Store the key in `Rails.application.credentials.scell.api_key` (encrypted). For async: ActiveJob + Sidekiq. Compatible with Rails 7.1+ and Ruby 3.2+.

Key facts

  • No Ruby SDK — `Faraday` or `HTTParty`
  • Service object in `app/services/scell_client.rb`
  • Key via `Rails.application.credentials.scell`
  • Async: ActiveJob + Sidekiq
  • Compatible with Rails 7.1+, Ruby 3.2+

Code example

# app/services/scell_client.rb
require 'faraday'

class ScellClient
  def initialize
    @conn = Faraday.new(url: 'https://api.scell.io/api/v1') do |c|
      c.headers['X-API-Key'] = Rails.application.credentials.scell.api_key
      c.request :json
      c.response :json
    end
  end

  def create_invoice(buyer:, amount:)
    @conn.post('/invoices', {
      format: 'factur-x',
      buyer: { name: buyer, is_individual: true },
      lines: [{ description: 'Service', quantity: 1, unit_price: amount, vat_rate: 20.0 }]
    }).body
  end
end

See also

Your cookie preferences

We use cookies to improve your experience. Essential cookies are always active. Cookie policy.