Mosaic SDK
Ruby SDK for the Mosaic API. Provides a simple interface to manage banks, DNAs, clones, and NAVs, routed through the Fluence API gateway.
Installation
Add the gem and its fluence-gateway-client runtime dependency to your application's Gemfile (both are hosted on GitHub Packages):
source 'https://rubygems.pkg.github.com/fluence-eu' do
gem 'mosaic-sdk'
gem 'fluence-gateway-client'
end
Then run:
bundle install
Configuration
Credentials and gateway URLs are managed by fluence-gateway-client. Set APPCENTER_CLIENT_ID and APPCENTER_CLIENT_SECRET and you're done — the SDK targets the built-in :mosaic tenant out of the box.
For overrides (URL, profile, SSL, etc.), see the fluence-gateway-client README.
Usage
Banks
# List all banks
banks = Mosaic::Sdk.Bank.list
# Search banks by name
banks = Mosaic::Sdk.Bank.list('My Bank')
# Get a specific bank
bank = Mosaic::Sdk.Bank(123).data
DNAs
# List all DNAs
dnas = Mosaic::Sdk.Dna.list
# Get a specific DNA
dna = Mosaic::Sdk.Dna(42).data
# List clones for a DNA
clones = Mosaic::Sdk.Dna(42).clones.list
# Get a specific clone for a DNA
clone = Mosaic::Sdk.Dna(42).clones(5).data
Clones
# List all clones
clones = Mosaic::Sdk.Clone.list
# Search clones by name
clones = Mosaic::Sdk.Clone.list('My Clone')
# Filter clones by code type
clones = Mosaic::Sdk.Clone.list(type: 'isin')
# Search and filter by code type
clones = Mosaic::Sdk.Clone.list('My Clone', type: 'isin')
# Get a specific clone
clone = Mosaic::Sdk.Clone(10).data
# Create a clone
clone = Mosaic::Sdk.Clone.create(
name: 'My Clone',
codes: [{ type: 'isin', value: 'FR0000000001' }],
source: 'manual',
dna_id: 42,
account_references: ['REF001']
)
# Create a clone within a DNA context (dna_id is inferred)
clone = Mosaic::Sdk.Dna(42).clones.create(
name: 'My Clone',
codes: [{ type: 'isin', value: 'FR0000000001' }],
source: 'manual'
)
# List NAVs for a clone
navs = Mosaic::Sdk.Clone(10).navs.list
NAVs
# Get the latest NAV for a clone
nav = Mosaic::Sdk.Clone(10).navs.latest.data
# Get NAV for a specific date
nav = Mosaic::Sdk.Clone(10).navs.for_date('2026-01-15').data
# Also works with Date objects
nav = Mosaic::Sdk.Clone(10).navs.for_date(Date.today).data
# Create a NAV
nav = Mosaic::Sdk.Clone(10).navs.create(
price: 150.25,
unit: 'price',
date: '2026-03-11',
pricing_method: 'net_asset_value_final',
bank_id: 1
)
Chaining associations
Models support association chaining from DNA down to NAV:
# DNA -> Clones -> NAVs
latest_nav = Mosaic::Sdk.Dna(42).clones(5).navs.latest.data
Development
After checking out the repo, run bin/setup to install dependencies.
Use bin/console for an interactive prompt with the SDK pre-loaded. Set the APPCENTER_CLIENT_ID and APPCENTER_CLIENT_SECRET environment variables (read directly by fluence-gateway-client) before launching:
APPCENTER_CLIENT_ID=your_id APPCENTER_CLIENT_SECRET=your_secret bin/console
Run the full catalog (lint + security + codequality + tests) with:
bundle exec fluence-ci all
License
The gem is available as open source under the terms of the MIT License.