# frozen_string_literal: true require_relative "base_client" module PortalConnectors class RemitanoClient < BaseClient SUCCESSFUL_STATUS_CODES = [200, 201].freeze def get_fiat_balance(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/fiat_account_balances" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_coin_balance(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/coin_account_balances" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_main_fiat_currency(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/main_fiat_currencies" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_fiat_currency_rate(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/fiat_currency_rates" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_list_rates(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/combine_ticker_prices" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def create_coin_withdrawal(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/coin_withdrawals/create" res = post_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def create_fiat_withdrawal(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/fiat_withdrawals/create" res = post_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_site_country_info(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/site_countries" res = post_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end def get_user_info(params) params.merge!( nonce: next_nonce, ) url = "#{host}/api/staff/users" res = get_with_signature(url, params, skip_ssl: true) [JSON.parse(res.body_str), SUCCESSFUL_STATUS_CODES.include?(res.response_code)] rescue => e return_error e end end end