Skip to main content

Installation

Build a gem

To build the Ruby code into a gem:
gem build tradewatch.gemspec
Then either install the gem locally:
gem install ./tradewatch-1.0.0.gem
(for development, run gem install --dev ./tradewatch-1.0.0.gem to install the development dependencies) or publish the gem to a gem hosting service, e.g. RubyGems. Finally add this to the Gemfile:
gem 'tradewatch', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository:
gem 'tradewatch', :git => 'https://github.com/tradewatch-io/ruby-sdk.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:
ruby -Ilib script.rb

Usage

# Load the gem
require 'tradewatch'

# Setup authorization
Tradewatch.configure do |config|
  # Configure API key authorization: api_key_query
  config.api_key['api_key_query'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api_key_query'] = 'Bearer'
end

api_instance = Tradewatch::AccountApi.new
limit = 56 # Integer | 
interval = Tradewatch::AccountUsageStatisticsInterval::1H # AccountUsageStatisticsInterval | 

begin
  #Usage statistics
  result = api_instance.get_usage(limit, interval)
  p result
rescue Tradewatch::ApiError => e
  puts "Exception when calling AccountApi->get_usage: #{e}"
end

More Examples

Find more examples in our GitHub repository.