coingecko_ruby 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,12 @@
1
1
  module CoingeckoRuby
2
2
  class Client
3
3
  module Status
4
+ # Fetches CoinGecko's API status.
5
+ #
6
+ # @return [Hash] returns CoinGecko's API status.
7
+ #
8
+ # @example Fetch CoinGecko's API status.
9
+ # client.status
4
10
  def status
5
11
  get('ping')
6
12
  end
@@ -9,17 +9,19 @@ module CoingeckoRuby
9
9
  def get(endpoint, options = {})
10
10
  url = BASE_URL + endpoint
11
11
  uri = URI(url)
12
- if options[:query]
13
- uri = build_params(uri, options[:query])
14
- end
12
+ uri = build_query(uri, options) unless options.empty?
15
13
  response = Net::HTTP.get(uri)
16
14
  JSON.parse(response)
17
15
  end
18
16
 
19
17
  private
20
18
 
21
- def build_params(uri, params)
22
- uri.query = URI.encode_www_form(params)
19
+ def build_query(uri, query)
20
+ if query[:options]
21
+ options = query.delete(:options)
22
+ query = query.merge(options)
23
+ end
24
+ uri.query = URI.encode_www_form(query)
23
25
  uri
24
26
  end
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module CoingeckoRuby
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  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.1.0
4
+ version: 0.2.0
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-05-13 00:00:00.000000000 Z
11
+ date: 2021-05-16 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.
@@ -18,13 +18,16 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - CHANGELOG.md
21
22
  - LICENSE.md
22
23
  - README.md
23
24
  - Rakefile
24
25
  - coingecko_ruby.gemspec
25
26
  - lib/coingecko_ruby.rb
26
27
  - lib/coingecko_ruby/client.rb
28
+ - lib/coingecko_ruby/client/categories.rb
27
29
  - lib/coingecko_ruby/client/coins.rb
30
+ - lib/coingecko_ruby/client/exchanges.rb
28
31
  - lib/coingecko_ruby/client/prices.rb
29
32
  - lib/coingecko_ruby/client/status.rb
30
33
  - lib/coingecko_ruby/connection.rb