Project

tangany

0.0
No release in over a year
Tangany is a German provider for custody of digital assets and crypto. See https://tangany.com/ for details.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 6.0, < 8.0.0
>= 1.6, < 2.0.0
>= 1.10, < 2.0.0
>= 2.7, < 2.8.0
 Project Readme

Tangany Ruby Library

CI Test coverage Code quality

The Tangany Ruby library provides convenient access to the Tangany APIs from applications written in the Ruby language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.


Documentation

See the API docs for more details.

Installation

You don't need this source code unless you want to modify the gem. If you just want to use the package, just run:

gem install tangany

If you want to build the gem from source:

gem build tangany.gemspec

Requirements

  • Ruby 2.7.5+.

Bundler

If you are installing via bundler, you should be sure to use the https rubygems source in your Gemfile, as any gems fetched over http could potentially be compromised in transit and alter the code of gems fetched securely over https:

source "https://rubygems.org"

gem "tangany"

Usage

The library needs to be configured with your account's secrets.

require "tangany"
Tangany.client_id = "..."
Tangany.client_secret = "..."
Tangany.environment = "..." # mainnet or testnet
Tangany.subscription = "..."
Tangany.vault_url = "..."
Tangany.version = "..."

customers_client = Tangany::Customers::Client.new
custody_client = Tangany::Custody::Client.new

Customers API

Natural persons

List natural_persons

collection = customers_client.natural_persons.list(limit: 21, sort: "asc", pageToken: "foo")

Create natural person

natural_person = customers_client.natural_persons.create(
  id: "ent_123456789",
  title: "Mr",
  firstName: "John",
  lastName: "Doe",
  gender: "M",
  birthDate: "1980-01-01",
  birthPlace: "Milano",
  birthCountry: "IT",
  birthName: "John",
  nationality: "IT",
  address: {
    country: "IT",
    city: "Milano",
    postcode: "20100",
    streetName: "Via Roma",
    streetNumber: "1",
  },
  email: "john.doe@example.com",
  kyc: {
    id: "kyc_123456789",
    date: "2021-01-01T00:00:00.000Z",
    method: "video_ident",
    document: {
      country: "IT",
      nationality: "IT",
      number: "123456789",
      issuedBy: "Milano",
      issueDate: "2015-01-01",
      validUntil: "2025-01-01",
      type: "id_card"
    }
  },
  pep: {
    checkDate: "2021-01-01T00:00:00.000Z",
    isExposed: true,
    source: "PEP source",
    reason: "PEP reason"
  },
  sanctions: {
    checkDate: "2021-01-01T00:00:00.000Z",
    isExposed: true,
    source: "Sanctions source",
    reason: "Sanctions reason"
  }
)

Retrieve natural person

customer = customers_client.natural_persons.retrieve("ent_123456789")

Update natural person

natural_person = customers_client.natural_persons.update(
  "ent_123456789",
  title: "Mr",
  firstName: "John",
  lastName: "Doe",
  gender: "M",
  birthDate: "1980-01-01",
  birthPlace: "Milano",
  birthCountry: "IT",
  birthName: "John",
  nationality: "IT",
  address: {
    country: "IT",
    city: "Milano",
    postcode: "20100",
    streetName: "Via Roma",
    streetNumber: "1",
  },
  email: "john.doe@example.com",
  kyc: {
    id: "kyc_123456789",
    date: "2021-01-01T00:00:00.000Z",
    method: "video_ident",
    document: {
      country: "IT",
      nationality: "IT",
      number: "123456789",
      issuedBy: "Milano",
      issueDate: "2015-01-01",
      validUntil: "2025-01-01",
      type: "id_card"
    }
  },
  pep: {
    checkDate: "2021-01-01T00:00:00.000Z",
    isExposed: true,
    source: "PEP source",
    reason: "PEP reason"
  },
  sanctions: {
    checkDate: "2021-01-01T00:00:00.000Z",
    isExposed: true,
    source: "Sanctions source",
    reason: "Sanctions reason"
  }
)

Delete natural person

response = customers_client.natural_persons.delete("ent_123456789")

Customers

List customers

collection = customers_client.customers.list(limit: 21, sort: "asc", pageToken: "foo")

Create customer

customer = customers_client.customers.create(
  id: "cus_123456789",
  owner: {
    entityId: "ent_123456789",
  },
  authorized: {
    entityId: "ent_123456789",
  },
  contracts: [{
    type: "standard",
    signedDate: "2020-09-04",
  }]
)

Retrieve customer

customer = customers_client.customers.retrieve("cus_123456789")

Update customer

customer = customers_client.customers.update(
  "cus_123456789",
  owner: {
    entityId: "ent_123456789",
  },
  authorized: {
    entityId: "ent_123456789",
  },
  contracts: [{
    type: "standard",
    signedDate: "2020-09-04",
  }]
)

Delete customer

response = customers_client.customers.delete("cus_123456789")

Wallet links

List wallet links

collection = customers_client.wallet_links.list(limit: 21, sort: "asc", pageToken: "foo")

Create wallet link

With an address:

wallet_link = customers_client.wallet_links.create(
  id: "wl_123456789",
  address: "0x1234567890abcdef1234567890abcdef12345678",
  assetId: "ETH",
  assignment: {
    customerId: "cus_123456789",
  }
)

With a wallet:

wallet_link = customers_client.wallet_links.create(
  id: "wl_123456789",
  wallet: "wal_123456789",
  assetId: "ETH",
  assignment: {
    customerId: "cus_123456789",
  }
)

Retrieve wallet link

wallet_link = customers_client.wallet_links.retrieve("wl_123456789")

Delete wallet link

response = customers_client.wallet_links.delete("wl_123456789")

Custody API

See lib/config/chains.json for the list of available chains.

Wallets

List wallets

collection = custody_client.wallets.list(limit: 21, order: "wallet", sort: "asc", start: 42, tags: { tag0: "tag 0", tag1: "tag 1" }, xtags: { tag2: "tag 2", tag3: "tag 3" })

Create wallet

wallet = custody_client.wallets.create(
  wallet: "wal_123456789",
  useHsm: false,
  tags: [{
    tag0: "tag 0"
  }, {
    tag1: "tag 1",
  }, {
    ...
  }, {
    tag9: "tag 9"
  }]
)

Retrieve wallet

wallet = custody_client.wallets.retrieve("wal_123456789")

Update wallet

wallet = custody_client.wallets.update(
  "wal_123456789",
  tags: [{
    tag0: "tag 0"
  }, {
    tag1: "tag 1",
  }, {
    ...
  }, {
    tag9: "tag 9"
  }]
)

Delete wallet

wallet_recovery = custody_client.customers.delete("wal_123456789")

Wallet statuses

Retrieve wallet status

wallet_status = custody_client.wallet_statuses(assetId: "ETH").retrieve("wal_123456789")

Development

Git config

Tell git where to find the project shared hooks:

git config core.hooksPath .githooks

Interactive console

bin/console

Testing

If Tangany API changes, edit the spec/factories and the spec/generators accordingly, then run all tests:

rspec

Fixtures will be regenerated automatically each time you run the tests.

It is also possible to run a test suite against the live API.

⚠️ Be sure to set environment variables not to production values before running the following command!

bin/test-live

Linting and code quality

Run the linter:

rubocop

Run the code quality checker:

rake quality_check

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bitbond/tangany-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

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

Code of Conduct

Everyone interacting in the Tangany::Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.