gecko-api 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gecko/base.rb +1 -0
- data/lib/gecko/resources/coin.rb +3 -3
- data/lib/gecko/version.rb +1 -1
- metadata +17 -4
- data/lib/gecko/resources/request.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f368680995dc3be05573be1fdb78cb6e0cbc8cc4b4fc3591989d1ceea4c0d5f
|
4
|
+
data.tar.gz: 7dc3477cefe77c0c3a71e0ef53e5385656dba78c80623ef1b4ef760782cf8558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 639c0086ad3c1b6dcf8aa39bf6363e37c52bf8b2b6c851fe63f6306c8c6e312d42053aad31a6d3268d22db12b89b29458bd0472cd5f748828f856eb7380a6c2d
|
7
|
+
data.tar.gz: 5338da64f30a24f5a6f94056c179fc286a1790166de272f913f59dcd5bef721bc6e9f8c04829a1e4fd77196ec78dcacc878963e561ea52729bf756a175929638
|
data/lib/gecko/base.rb
CHANGED
data/lib/gecko/resources/coin.rb
CHANGED
@@ -26,7 +26,7 @@ module Gecko
|
|
26
26
|
else
|
27
27
|
URI('https://api.coingecko.com/api/v3/coins/list')
|
28
28
|
end
|
29
|
-
|
29
|
+
Request::Http.request(uri: uri, method: 'GET')
|
30
30
|
end
|
31
31
|
|
32
32
|
def formatting(payload:, symbol: nil)
|
@@ -38,8 +38,8 @@ module Gecko
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def formatting_info(payload:, symbol:)
|
41
|
-
info = payload.select { |x| x['symbol'] == symbol }
|
42
|
-
info =
|
41
|
+
info = payload.select { |x| x['symbol'] == symbol }
|
42
|
+
info = [] if info.nil?
|
43
43
|
|
44
44
|
info
|
45
45
|
end
|
data/lib/gecko/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gecko-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Baldazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aga-request
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: zeitwerk
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +162,6 @@ files:
|
|
148
162
|
- lib/gecko/autoloader.rb
|
149
163
|
- lib/gecko/base.rb
|
150
164
|
- lib/gecko/resources/coin.rb
|
151
|
-
- lib/gecko/resources/request.rb
|
152
165
|
- lib/gecko/version.rb
|
153
166
|
homepage: https://github.com/Baldaz02/gecko-ruby
|
154
167
|
licenses:
|
@@ -172,5 +185,5 @@ requirements: []
|
|
172
185
|
rubygems_version: 3.3.24
|
173
186
|
signing_key:
|
174
187
|
specification_version: 4
|
175
|
-
summary: gecko0.0.
|
188
|
+
summary: gecko0.0.3
|
176
189
|
test_files: []
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Gecko
|
4
|
-
class Request < Base
|
5
|
-
class << self
|
6
|
-
def request(uri:, method:)
|
7
|
-
req = get_method(name: method, uri: uri)
|
8
|
-
req['Content-Type'] = 'application/json'
|
9
|
-
|
10
|
-
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
11
|
-
http.request(req)
|
12
|
-
end
|
13
|
-
|
14
|
-
JSON.parse(res.body)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_method(name:, uri:)
|
18
|
-
case name
|
19
|
-
when 'GET'
|
20
|
-
req = Net::HTTP::Get.new(uri)
|
21
|
-
# when 'POST'
|
22
|
-
# req = Net::HTTP::Post.new(uri)
|
23
|
-
# when 'DELETE'
|
24
|
-
# req = Net::HTTP::Delete.new(uri)
|
25
|
-
end
|
26
|
-
|
27
|
-
req
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|