coingecko_ruby 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +27 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -10
- data/fixtures/vcr_cassettes/test_that_it_gets_a_specific_exchange_ticker_from_an_exchange.yml +70 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_eth_exchange_rate.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_usd_exchange_rate.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_daily_historical_prices_for_one_coin.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_historical_price_for_one_coin_at_a_previous_date.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_hourly_historical_prices_for_one_coin.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_indexes_by_market_id_and_coin_id.yml +66 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_last_7_days_exchange_volume_from_an_exchange.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin.yml +98 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin_in_myr.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_multiple_coins_in_eth.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_minutely_historical_prices_for_one_coin.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_30_days_in_myr.yml +47 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_7_days.yml +47 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin.yml +49 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin_in_a_different_currency.yml +49 -0
- data/lib/coingecko_ruby/client.rb +6 -0
- data/lib/coingecko_ruby/client/categories.rb +21 -6
- data/lib/coingecko_ruby/client/coins.rb +28 -15
- data/lib/coingecko_ruby/client/derivatives.rb +30 -9
- data/lib/coingecko_ruby/client/events.rb +21 -6
- data/lib/coingecko_ruby/client/exchanges.rb +45 -13
- data/lib/coingecko_ruby/client/finance.rb +14 -4
- data/lib/coingecko_ruby/client/indexes.rb +22 -7
- data/lib/coingecko_ruby/client/infos.rb +27 -8
- data/lib/coingecko_ruby/client/prices.rb +74 -30
- data/lib/coingecko_ruby/connection.rb +5 -9
- data/lib/coingecko_ruby/version.rb +1 -1
- metadata +4 -2
@@ -4,24 +4,20 @@ require 'json'
|
|
4
4
|
|
5
5
|
module CoingeckoRuby
|
6
6
|
module Connection
|
7
|
-
BASE_URL = 'https://api.coingecko.com/api/v3/'
|
7
|
+
BASE_URL = 'https://api.coingecko.com/api/v3/'.freeze
|
8
8
|
|
9
|
-
def get(endpoint,
|
9
|
+
def get(endpoint, **params)
|
10
10
|
url = BASE_URL + endpoint
|
11
11
|
uri = URI(url)
|
12
|
-
uri =
|
12
|
+
uri = build_request(uri, params) unless params.empty?
|
13
13
|
response = Net::HTTP.get(uri)
|
14
14
|
JSON.parse(response)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def
|
20
|
-
|
21
|
-
options = query.delete(:options)
|
22
|
-
query = query.merge(options)
|
23
|
-
end
|
24
|
-
uri.query = URI.encode_www_form(query)
|
19
|
+
def build_request(uri, params)
|
20
|
+
uri.query = URI.encode_www_form(params)
|
25
21
|
uri
|
26
22
|
end
|
27
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coingecko_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Foo Siang Sen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An easy-to-use client/wrapper for CoinGecko's crypto API. Get prices,
|
14
14
|
exchanges, volume, and more without building your own API class.
|
@@ -20,6 +20,7 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- ".github/workflows/ruby.yml"
|
22
22
|
- ".gitignore"
|
23
|
+
- ".ruby-version"
|
23
24
|
- ".travis.yml"
|
24
25
|
- CHANGELOG.md
|
25
26
|
- Gemfile
|
@@ -52,6 +53,7 @@ files:
|
|
52
53
|
- fixtures/vcr_cassettes/test_that_it_gets_historical_price_for_one_coin_at_a_previous_date.yml
|
53
54
|
- fixtures/vcr_cassettes/test_that_it_gets_hourly_historical_prices_for_one_coin.yml
|
54
55
|
- fixtures/vcr_cassettes/test_that_it_gets_indexes.yml
|
56
|
+
- fixtures/vcr_cassettes/test_that_it_gets_indexes_by_market_id_and_coin_id.yml
|
55
57
|
- fixtures/vcr_cassettes/test_that_it_gets_indexes_by_market_id_and_index_id.yml
|
56
58
|
- fixtures/vcr_cassettes/test_that_it_gets_indexes_ids.yml
|
57
59
|
- fixtures/vcr_cassettes/test_that_it_gets_last_7_days_exchange_volume_from_an_exchange.yml
|