This API provides an aggregated, unified access point to many cryptocurrency exchanges and fiat-to-cryptocurrency onramps.
This client library is a Ruby gem which can be compiled and used in your Ruby and Ruby on Rails project. This library requires a few gems from the RubyGems repository.
- Open the command line interface or the terminal and navigate to the folder containing the source code.
- Run
gem build gem_api.gemspec
to build the gem. - Once built, the gem can be installed on the current work environment using
gem install gem_api-1.2.10.gem
The following section explains how to use the GemApi Ruby Gem in a new Rails project using RubyMine™. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Close any existing projects in RubyMine™ by selecting File -> Close Project
. Next, click on Create New Project
to create a new project from scratch.
Next, provide TestApp
as the project name, choose Rails Application
as the project type, and click OK
.
In the next dialog make sure that correct Ruby SDK is being used (minimum 2.0.0) and click OK
.
This will create a new Rails Application project with an existing set of files and folder.
In order to use the GemApi gem in the new project we must add a gem reference. Locate the Gemfile
in the Project Explorer window under the TestApp
project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line: gem 'gem_api', '~> 1.2.10'
Once the TestApp
project is created, a folder named controllers
will be visible in the Project Explorer under the following path: TestApp > app > controllers
. Right click on this folder and select New -> Run Rails Generator...
.
Selecting the said option will popup a small window where the generator names are displayed. Here, select the controller
template.
Next, a popup window will ask you for a Controller name and included Actions. For controller name provide Hello
and include an action named Index
and click OK
.
A new controller class anmed HelloController
will be created in a file named hello_controller.rb
containing a method named Index
. In this method, add code for initialization and a sample for its usage.
You can test the generated SDK and the server with automatically generated test cases as follows:
- From terminal/cmd navigate to the root directory of the SDK.
- Invoke:
bundle exec rake
In order to setup authentication and initialization of the API client, you need the following information.
Parameter | Description |
---|---|
x_gem_api_key | Accepts an API Key generated for your Application. If you don't have an API Key yet, go to https://gem.co to sign up and generate your key. |
x_gem_access_timestamp | Accepts current timestamp as used in the request signature. |
x_gem_signature | Accepts a valid signature for your request. You must generate this signature using your Gem API Secret, and following the procedure outlined at <http://developers.gem.co/reference#authentication-1. |
API client can be initialized as following.
# Configuration parameters and credentials
x_gem_api_key = 'x_gem_api_key' # Accepts an API Key generated for your Application. If you don't have an API Key yet, go to <https://gem.co> to sign up and generate your key.
x_gem_access_timestamp = 'x_gem_access_timestamp' # Accepts current timestamp as used in the request signature.
x_gem_signature = 'x_gem_signature' # Accepts a valid signature for your request. You must generate this signature using your Gem API Secret, and following the procedure outlined at <http://developers.gem.co/reference#authentication-1.
client = GemApi::GemApiClient.new(
x_gem_api_key: x_gem_api_key,
x_gem_access_timestamp: x_gem_access_timestamp,
x_gem_signature: x_gem_signature
)
The added initlization code can be debugged by putting a breakpoint in the Index
method and running the project in debug mode by selecting Run -> Debug 'Development: TestApp'
.
- ConnectionsController
- ProfilesController
- UserManagementController
- InstitutionsController
- AccountsController
- TransactionsController
- AssetsController
The singleton instance of the ConnectionsController
class can be accessed from the API Client.
connections_controller = client.connections
Get a list of Connections.
def get_connections(user_id = nil); end
Parameter | Tags | Description |
---|---|---|
user_id | Optional |
TODO: Add a parameter description |
user_id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = connections_controller.get_connections(user_id)
Create a new Connection object and receive an access token.
def create_connection(body,
user_id = nil); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
user_id | Optional |
TODO: Add a parameter description |
body = { 'key' => 'value' }
user_id = UUID.new
result = connections_controller.create_connection(body, user_id)
Retrieves a
Connection
object by its identifier.
def get_connection(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = connections_controller.get_connection(id)
Update Connection with new credentials.
def put_connection(id,
body); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
body | Required |
TODO: Add a parameter description |
id = UUID.new
body = { 'key' => 'value' }
result = connections_controller.put_connection(id, body)
Delete a Connection, permanently revoking access.
def delete_connection(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = connections_controller.delete_connection(id)
Coinbase OAuth Complete
def create_coinbase_oauth_complete(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = OauthRequestFormat.new
result = connections_controller.create_coinbase_oauth_complete(body)
The singleton instance of the ProfilesController
class can be accessed from the API Client.
profiles_controller = client.profiles
Get a list of
Profiles
.
def get_profiles(user_id = nil); end
Parameter | Tags | Description |
---|---|---|
user_id | Optional |
TODO: Add a parameter description |
user_id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = profiles_controller.get_profiles(user_id)
Create a new
Profile
object and receive an access token.
def create_profile(body,
user_id = nil); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
user_id | Optional |
TODO: Add a parameter description |
body = NewProfile.new
user_id = UUID.new
result = profiles_controller.create_profile(body, user_id)
Create a temporary
Profile
object that expires in 1 hour. Any data associated with an expiredProfile
is permanently deleted. This endpoint returns an access token.
def create_temporary_profile(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = NewProfile.new
result = profiles_controller.create_temporary_profile(body)
Retrieves
Profile
objects for aUser
or anApplication
.
def get_profile(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = profiles_controller.get_profile(id)
Update
Profile
with new or changed attributes.
def put_profile(id,
body); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
body | Required |
TODO: Add a parameter description |
id = UUID.new
body = NewProfile.new
result = profiles_controller.put_profile(id, body)
Delete a
Profile
, permanently revoking access.
def delete_profile(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = profiles_controller.delete_profile(id)
The singleton instance of the UserManagementController
class can be accessed from the API Client.
userManagement_controller = client.user_management
Get a list of Users associated with your Application.
def get_users; end
result = userManagement_controller.get_users()
Create a Gem User. A User may either be private (limited to your application) or public (passportable across the Gem network of partners).
def create_user(body = nil); end
Parameter | Tags | Description |
---|---|---|
body | Optional |
TODO: Add a parameter description |
body = NewUser.new
result = userManagement_controller.create_user(body)
Record user's consent to Gem's Terms of Service and Privacy Policy. This is used by our widgets.
def update_consent_user(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = userManagement_controller.update_consent_user(id)
Retrieves User and its linked Connections and Profiles.
def get_user(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = userManagement_controller.get_user(id)
Delete a User. For private users, this permanently deletes the user. For public users, this revokes your access to the public user, but doesn't delete the user.
def delete_user(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = userManagement_controller.delete_user(id)
The singleton instance of the InstitutionsController
class can be accessed from the API Client.
institutions_controller = client.institutions
Get a list of Institutions that Gem supports.
def get_institutions; end
result = institutions_controller.get_institutions()
Get details about an Institution.
def get_institution(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = institutions_controller.get_institution(id)
Open a new user account at an Institution. Typically a new user will be required to submit a KYC profile. You may attach an existing Profile object to this request. This endpoint is currently supported for Wyre and Coinify.
def create_institution_user(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = NewInstitutionUser.new
result = institutions_controller.create_institution_user(body)
Returns data about a user's account at an Institution, including their current status of approvals on KYC and trading limits.
def get_institution_user(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = institutions_controller.get_institution_user(id)
The singleton instance of the AccountsController
class can be accessed from the API Client.
accounts_controller = client.accounts
Get a list of wallets and payment methods attached to an InstitutionUser.
def get_accounts(user_id = nil,
connection_id = nil); end
Parameter | Tags | Description |
---|---|---|
user_id | Optional |
TODO: Add a parameter description |
connection_id | Optional |
TODO: Add a parameter description |
user_id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
connection_id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = accounts_controller.get_accounts(user_id, connection_id)
Some Institutions support creating new payment methods and wallets via API. This endpoint gives you a simple way to create a new wallet or payment method at your user's Institution. Supported Institutions include: Wyre, Coinify, Coinbase (coming soon).
def create_account(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = Account.new
result = accounts_controller.create_account(body)
Get details about an account, including name, balance, base currency and other details that may be available.
def get_account(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = accounts_controller.get_account(id)
The singleton instance of the TransactionsController
class can be accessed from the API Client.
transactions_controller = client.transactions
View all transactions submitted through your Application.
def get_transactions(page = nil); end
Parameter | Tags | Description |
---|---|---|
page | Optional |
TODO: Add a parameter description |
page = 183
result = transactions_controller.get_transactions(page)
Initiate a buy or transfer transaction for an existing Connection. Transactions take a
source
account, adestination
account, anamount
, and acurrency
. Successfully submitted transactions return atransaction_id
to monitor the status of the transaction in future API calls or webhook notifications.
def create_transaction(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = NewTransaction.new
result = transactions_controller.create_transaction(body)
Get transaction details by
transaction_id
.
def get_transaction(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = transactions_controller.get_transaction(id)
Cancel a pending transaction. This may not always be possible for all third-party services.
def delete_cancel_transaction(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 3fa85f64-5717-4562-b3fc-2c963f66afa6
result = transactions_controller.delete_cancel_transaction(id)
Withdraw cryptocurrency from a source
Account
to aBlockchainAddress
or anAccount
.
def create_transfer(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = Transaction.new
result = transactions_controller.create_transfer(body)
Buy cryptocurrency from a source fiat
Account
. We currently support Wyre and Coinify.
def create_buy(body); end
Parameter | Tags | Description |
---|---|---|
body | Required |
TODO: Add a parameter description |
body = Transaction.new
result = transactions_controller.create_buy(body)
The singleton instance of the AssetsController
class can be accessed from the API Client.
assets_controller = client.assets
Returns a full list of assets in the Gem ecosystem, with our normalized ticker symbols.
def get_assets(category = nil); end
Parameter | Tags | Description |
---|---|---|
category | Optional |
TODO: Add a parameter description |
category = GemApi::AssetCategoriesEnum::CRYPTOCURRENCY
result = assets_controller.get_assets(category)
Resolve to Institution-specific ticker symbol by specifying the Gem Asset ID.
def get_asset(id); end
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
id = 'bitcoin'
result = assets_controller.get_asset(id)
Returns current asset price quotes for an array of assets. Quotes may be filtered by source (e.g. Coinbase, CoinMarketCap, Wyre), and may be returned in the currency of your choice (e.g. USD, EUR, BTC).
def get_assets_prices(quote_asset_id = nil,
asset_ids = nil); end
Parameter | Tags | Description |
---|---|---|
quote_asset_id | Optional |
TODO: Add a parameter description |
asset_ids | Optional Collection |
TODO: Add a parameter description |
quote_asset_id = 'bitcoin'
asset_ids = ['asset_ids']
result = assets_controller.get_assets_prices(quote_asset_id, asset_ids)
Returns current asset price quote for a single asset. Quotes may be filtered by source (e.g. Coinbase, CoinMarketCap, Wyre), and may be returned in the currency of your choice (e.g. USD, EUR, BTC).
def get_price(asset_id,
quote_asset_id); end
Parameter | Tags | Description |
---|---|---|
asset_id | Required |
TODO: Add a parameter description |
quote_asset_id | Required |
TODO: Add a parameter description |
asset_id = 'bitcoin'
quote_asset_id = 'bitcoin'
result = assets_controller.get_price(asset_id, quote_asset_id)