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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/coingecko_ruby.gemspec +1 -1
- data/lib/coingecko_ruby.rb +1 -1
- data/lib/coingecko_ruby/client.rb +4 -0
- data/lib/coingecko_ruby/client/categories.rb +406 -0
- data/lib/coingecko_ruby/client/coins.rb +214 -12
- data/lib/coingecko_ruby/client/exchanges.rb +1600 -0
- data/lib/coingecko_ruby/client/prices.rb +484 -8
- data/lib/coingecko_ruby/client/status.rb +6 -0
- data/lib/coingecko_ruby/connection.rb +7 -5
- data/lib/coingecko_ruby/version.rb +1 -1
- metadata +5 -2
@@ -9,17 +9,19 @@ module CoingeckoRuby
|
|
9
9
|
def get(endpoint, options = {})
|
10
10
|
url = BASE_URL + endpoint
|
11
11
|
uri = URI(url)
|
12
|
-
|
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
|
22
|
-
|
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
|
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.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-
|
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
|