Class: CryptoApis::ExchangeRatesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_apis/api/exchange_rates_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ExchangeRatesApi



19
20
21
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_exchange_rate_by_asset_symbols(from_asset_symbol, to_asset_symbol, opts = {}) ⇒ GetExchangeRateByAssetSymbolsR

Get Exchange Rate By Asset Symbols Through this endpoint customers can obtain exchange rates by asset symbols. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset symbol.

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user.

  • :calculation_timestamp (Integer)

    Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. Oldest possible timestamp is 30 days.



30
31
32
33
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 30

def get_exchange_rate_by_asset_symbols(from_asset_symbol, to_asset_symbol, opts = {})
  data, _status_code, _headers = get_exchange_rate_by_asset_symbols_with_http_info(from_asset_symbol, to_asset_symbol, opts)
  data
end

#get_exchange_rate_by_asset_symbols_with_http_info(from_asset_symbol, to_asset_symbol, opts = {}) ⇒ Array<(GetExchangeRateByAssetSymbolsR, Integer, Hash)>

Get Exchange Rate By Asset Symbols Through this endpoint customers can obtain exchange rates by asset symbols. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset symbol.

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :calculation_timestamp (Integer)

    Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. Oldest possible timestamp is 30 days.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 43

def get_exchange_rate_by_asset_symbols_with_http_info(from_asset_symbol, to_asset_symbol, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExchangeRatesApi.get_exchange_rate_by_asset_symbols ...'
  end
  # verify the required parameter 'from_asset_symbol' is set
  if @api_client.config.client_side_validation && from_asset_symbol.nil?
    fail ArgumentError, "Missing the required parameter 'from_asset_symbol' when calling ExchangeRatesApi.get_exchange_rate_by_asset_symbols"
  end
  # verify the required parameter 'to_asset_symbol' is set
  if @api_client.config.client_side_validation && to_asset_symbol.nil?
    fail ArgumentError, "Missing the required parameter 'to_asset_symbol' when calling ExchangeRatesApi.get_exchange_rate_by_asset_symbols"
  end
  # resource path
  local_var_path = '/market-data/exchange-rates/by-symbols/{fromAssetSymbol}/{toAssetSymbol}'.sub('{' + 'fromAssetSymbol' + '}', CGI.escape(from_asset_symbol.to_s)).sub('{' + 'toAssetSymbol' + '}', CGI.escape(to_asset_symbol.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?
  query_params[:'calculationTimestamp'] = opts[:'calculation_timestamp'] if !opts[:'calculation_timestamp'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetExchangeRateByAssetSymbolsR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ExchangeRatesApi.get_exchange_rate_by_asset_symbols",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExchangeRatesApi#get_exchange_rate_by_asset_symbols\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_exchange_rate_by_assets_ids(from_asset_id, to_asset_id, opts = {}) ⇒ GetExchangeRateByAssetsIDsR

Get Exchange Rate By Assets IDs Through this endpoint customers can obtain exchange rates by asset IDs. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset Reference ID.

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :calculation_timestamp (Integer)

    Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. Oldest possible timestamp is 30 days.



105
106
107
108
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 105

def get_exchange_rate_by_assets_ids(from_asset_id, to_asset_id, opts = {})
  data, _status_code, _headers = get_exchange_rate_by_assets_ids_with_http_info(from_asset_id, to_asset_id, opts)
  data
end

#get_exchange_rate_by_assets_ids_with_http_info(from_asset_id, to_asset_id, opts = {}) ⇒ Array<(GetExchangeRateByAssetsIDsR, Integer, Hash)>

Get Exchange Rate By Assets IDs Through this endpoint customers can obtain exchange rates by asset IDs. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset Reference ID.

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :calculation_timestamp (Integer)

    Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. Oldest possible timestamp is 30 days.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/crypto_apis/api/exchange_rates_api.rb', line 118

def get_exchange_rate_by_assets_ids_with_http_info(from_asset_id, to_asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExchangeRatesApi.get_exchange_rate_by_assets_ids ...'
  end
  # verify the required parameter 'from_asset_id' is set
  if @api_client.config.client_side_validation && from_asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'from_asset_id' when calling ExchangeRatesApi.get_exchange_rate_by_assets_ids"
  end
  # verify the required parameter 'to_asset_id' is set
  if @api_client.config.client_side_validation && to_asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'to_asset_id' when calling ExchangeRatesApi.get_exchange_rate_by_assets_ids"
  end
  # resource path
  local_var_path = '/market-data/exchange-rates/by-asset-ids/{fromAssetId}/{toAssetId}'.sub('{' + 'fromAssetId' + '}', CGI.escape(from_asset_id.to_s)).sub('{' + 'toAssetId' + '}', CGI.escape(to_asset_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?
  query_params[:'calculationTimestamp'] = opts[:'calculation_timestamp'] if !opts[:'calculation_timestamp'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetExchangeRateByAssetsIDsR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ExchangeRatesApi.get_exchange_rate_by_assets_ids",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExchangeRatesApi#get_exchange_rate_by_assets_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end