Skip to content

Commit

Permalink
FIX: Fixed get method calls to be compatible with Ruby 3
Browse files Browse the repository at this point in the history
  • Loading branch information
julianfoo committed Jul 19, 2021
1 parent dba14d6 commit fe8e177
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.1
8 changes: 4 additions & 4 deletions lib/coingecko_ruby/client/coins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Coins
# }, {
# ]
def coins_list(**options)
get 'coins/list', options
get 'coins/list', **options
end

# Fetches detailed current data for a coin.
Expand All @@ -38,7 +38,7 @@ def coins_list(**options)
# @example Fetch Bitcoin's current data.
# client.coin('bitcoin')
def coin(id, **options)
get "coins/#{id}", options
get "coins/#{id}", **options
end

# @deprecated Use {#coin} instead
Expand Down Expand Up @@ -128,7 +128,7 @@ def get_coin_data(id:, options: {})
# }],
# }
def tickers(id, **options)
get "coins/#{id}/tickers", options
get "coins/#{id}/tickers", **options
end

# @deprecated Use {#tickers} instead
Expand Down Expand Up @@ -216,7 +216,7 @@ def get_tickers(id:, options: {})
# }
# ]
def markets(ids, **options)
get 'coins/markets', { ids: ids, **options }
get 'coins/markets', ids: ids, **options
end

# @deprecated Use {#markets} instead
Expand Down
6 changes: 3 additions & 3 deletions lib/coingecko_ruby/client/derivatives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module Derivatives
# },
# ]
def derivatives(**options)
get 'derivatives', options
get 'derivatives', **options
end

# @deprecated Use {#derivatives} instead
Expand Down Expand Up @@ -79,7 +79,7 @@ def get_derivatives(options: {})
# "url" => "https://www.binance.com/"
# }]
def derivative_exchanges(**options)
get 'derivatives/exchanges', options
get 'derivatives/exchanges', **options
end

# @deprecated Use {#derivative_exchanges} instead
Expand Down Expand Up @@ -112,7 +112,7 @@ def get_derivative_exchanges(options: {})
# "url" => "https://www.binance.com/"
# }
def derivative_exchange(id, **options)
get "derivatives/exchanges/#{id}", options
get "derivatives/exchanges/#{id}", **options
end

# @deprecated Use {#derivative_exchange} instead
Expand Down
2 changes: 1 addition & 1 deletion lib/coingecko_ruby/client/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Events
# @example Get all upcoming events.
# client.events(upcoming_events_only: true)
def events(**options)
get 'events', options
get 'events', **options
end

# @deprecated Use {#events} instead
Expand Down
8 changes: 4 additions & 4 deletions lib/coingecko_ruby/client/exchanges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Exchanges
# "trade_volume_24h_btc_normalized" => 982949.3975723931
# }]
def exchanges(**options)
get 'exchanges', options
get 'exchanges', **options
end

# @deprecated Use {#exchanges} instead
Expand Down Expand Up @@ -121,7 +121,7 @@ def get_exchanges_ids
# }]
# }
def exchange_tickers(id, **options)
get "exchanges/#{id}/tickers", options
get "exchanges/#{id}/tickers", **options
end

# @deprecated Use {#exchange_tickers} instead
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_exchange_tickers(id:, options: {})
# }]
# }
def exchange_status(id, **options)
get "exchanges/#{id}/status_updates", options
get "exchanges/#{id}/status_updates", **options
end

# @deprecated Use {#exchange_status} instead
Expand All @@ -181,7 +181,7 @@ def get_exchange_status_updates(id:, options: {})
# [1620557400000.0, "1042158.4333253484568599192332614201045319574863305612009609211497295171074087677404153278624"]
# ]
def exchange_volume(id, days: 7, **options)
get "exchanges/#{id}/volume_chart", { days: days, **options }
get "exchanges/#{id}/volume_chart", days: days, **options
end

# @deprecated Use {#exchange_volume} instead
Expand Down
4 changes: 2 additions & 2 deletions lib/coingecko_ruby/client/finance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Finance
# }
# ]
def finance_platforms(**options)
get 'finance_platforms', options
get 'finance_platforms', **options
end

# @deprecated Use {#finance_platforms} instead
Expand Down Expand Up @@ -88,7 +88,7 @@ def get_finance_platforms(options: {})
# "redeem_at"=>0}
# ]
def finance_products(**options)
get 'finance_products', options
get 'finance_products', **options
end

# @deprecated Use {#finance_products} instead
Expand Down
4 changes: 2 additions & 2 deletions lib/coingecko_ruby/client/indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Indexes
# "is_multi_asset_composite"=>false}
# ]
def indexes(**options)
get 'indexes', options
get 'indexes', **options
end

# @deprecated Use {#indexes} instead
Expand Down Expand Up @@ -76,7 +76,7 @@ def get_indexes_ids
# "is_multi_asset_composite"=>false
# }
def indexes_by_market_and_coin(market_id, coin_id, **options)
get "indexes/#{market_id}/#{coin_id}", options
get "indexes/#{market_id}/#{coin_id}", **options
end

# @deprecated Use {#indexes_by_market_and_coin} instead
Expand Down
2 changes: 1 addition & 1 deletion lib/coingecko_ruby/client/infos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_trending_searches
# }]
# }
def status_updates(**options)
get 'status_updates', options
get 'status_updates', **options
end

def get_status_updates(options: {})
Expand Down
12 changes: 6 additions & 6 deletions lib/coingecko_ruby/client/prices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Prices
def price(ids, currency: 'usd', **options)
ids = ids.join(',') if ids.is_a? Array
currency = currency.join(',') if currency.is_a? Array
get 'simple/price', { ids: ids, vs_currencies: currency, **options }
get 'simple/price', ids: ids, vs_currencies: currency, **options
end

# @see Alias for {#price}
Expand Down Expand Up @@ -122,7 +122,7 @@ def get_price(id:, currency: 'usd', options: {})
def historical_price(id, date:, **options)
date = Time.now.strftime('%d-%m-%Y') if date.nil?

get "coins/#{id}/history", { date: date, **options }
get "coins/#{id}/history", date: date, **options
end

# @deprecated Use {#historical_price} instead
Expand Down Expand Up @@ -158,7 +158,7 @@ def get_historical_price_on_date(id:, date:)
# ]
# }
def minutely_historical_price(id, currency: 'usd', **options)
get "coins/#{id}/market_chart", { vs_currency: currency, days: 1, **options }
get "coins/#{id}/market_chart", vs_currency: currency, days: 1, **options
end

# @deprecated Use {#minutely_historical_price} instead
Expand Down Expand Up @@ -195,7 +195,7 @@ def get_minutely_historical_prices(id:, currency: 'usd')
def hourly_historical_price(id, currency: 'usd', days: 7, **options)
return daily_historical_price(id, currrency: currency, days: days) if days > 90

get "coins/#{id}/market_chart", { vs_currency: currency, days: days, **options }
get "coins/#{id}/market_chart", vs_currency: currency, days: days, **options
end

# @deprecated Use {#hourly_historical_price} instead
Expand Down Expand Up @@ -229,7 +229,7 @@ def get_hourly_historical_prices(id:, days:, currency: 'usd')
# ]
# }
def daily_historical_price(id, currency: 'usd', days: 7, **options)
get "coins/#{id}/market_chart", { vs_currency: currency, days: days, interval: 'daily', **options }
get "coins/#{id}/market_chart", vs_currency: currency, days: days, interval: 'daily', **options
end

# @deprecated Use {#daily_historical_price} instead
Expand All @@ -256,7 +256,7 @@ def get_daily_historical_prices(id:, days:, currency: 'usd')
# [1620576000000, 57956.7, 57956.7, 56636.68, 57302.22],
# ]
def ohlc(id, currency: 'usd', days: 7, **options)
get "coins/#{id}/ohlc", { vs_currency: currency, days: days, **options }
get "coins/#{id}/ohlc", vs_currency: currency, days: days, **options
end

# @deprecated Use {#ohlc} instead
Expand Down

0 comments on commit fe8e177

Please sign in to comment.