Class: Cryptopay::Rates
- Inherits:
-
Object
- Object
- Cryptopay::Rates
- Defined in:
- lib/cryptopay/api/rates.rb
Instance Method Summary collapse
-
#all(_opts = {}) ⇒ RatesResult
Retrieve all rates This endpoint allows you to retrieve all public rates.
-
#initialize(connection) ⇒ Rates
constructor
A new instance of Rates.
-
#retrieve(base_currency, quote_currency, _opts = {}) ⇒ RateResult
Retrieve a pair rate This endpoint allows you to retrieve a public rate by currency pair.
Constructor Details
#initialize(connection) ⇒ Rates
Returns a new instance of Rates.
8 9 10 |
# File 'lib/cryptopay/api/rates.rb', line 8 def initialize(connection) @connection = connection end |
Instance Method Details
#all(_opts = {}) ⇒ RatesResult
Retrieve all rates This endpoint allows you to retrieve all public rates.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cryptopay/api/rates.rb', line 16 def all(_opts = {}) path = '/api/rates' req = Request.new( method: :get, path: path ) connection.call(req, return_type: RatesResult) end |
#retrieve(base_currency, quote_currency, _opts = {}) ⇒ RateResult
Retrieve a pair rate This endpoint allows you to retrieve a public rate by currency pair.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cryptopay/api/rates.rb', line 33 def retrieve(base_currency, quote_currency, _opts = {}) path = '/api/rates/{base_currency}/{quote_currency}' path = path.sub('{base_currency}', CGI.escape(base_currency.to_s)) path = path.sub('{quote_currency}', CGI.escape(quote_currency.to_s)) req = Request.new( method: :get, path: path ) connection.call(req, return_type: RateResult) end |