CryptoPriceFinder 0.5.0 → 0.6.1
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/lib/CryptoPriceFinder/crypto.rb +154 -113
- data/lib/CryptoPriceFinder/version.rb +1 -1
- data/lib/CryptoPriceFinder.rb +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6405b08fa49e388d97bb81881ff2dd70e0773ff1716be77a204725d03ede3da
|
4
|
+
data.tar.gz: 0b42580ffc8c61b628f06faf7e640aa6738ab046f063f7025e696898c2115fa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30ed7a48ff5e9e35c26d3d63273423d8840c4a7462793e0c18d5953e2567410da90e49fba27a3c9954207591e8cf6420f95458f8f72b02d7a7a39d35286f0b65
|
7
|
+
data.tar.gz: c8f3febfb03580fcdf736597f43a2172740837a1895838e9d13b11c922f1b35ead1a784eb584f6ce8475a6899d602760808a4395ca38c96b9759200c7ea849c0
|
@@ -1,113 +1,154 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'httparty'
|
5
|
+
class String
|
6
|
+
def comma
|
7
|
+
reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module CryptoPriceFinder
|
12
|
+
class << self
|
13
|
+
private
|
14
|
+
|
15
|
+
URL = 'https://duckduckgo.com/js/spice/cryptocurrency/'
|
16
|
+
def clean(input)
|
17
|
+
input.gsub('ddg_spice_cryptocurrency(', '').gsub(');', '').strip
|
18
|
+
end
|
19
|
+
|
20
|
+
def http(crypto, fiat, amount)
|
21
|
+
r = HTTParty.get(File.join(URL, crypto, fiat, amount.to_s)).body
|
22
|
+
r_clean = clean(r)
|
23
|
+
json = JSON.parse(r_clean)['data']['quote']
|
24
|
+
q = json.keys.shift.to_s
|
25
|
+
json[q]['price'].round(4)
|
26
|
+
end
|
27
|
+
|
28
|
+
public
|
29
|
+
|
30
|
+
def monero(amount)
|
31
|
+
http('xmr', 'usd', amount)
|
32
|
+
end
|
33
|
+
|
34
|
+
def stellar(amount)
|
35
|
+
http('xlm', 'usd', amount)
|
36
|
+
end
|
37
|
+
|
38
|
+
def bitcoin(amount)
|
39
|
+
http('btc', 'usd', amount)
|
40
|
+
end
|
41
|
+
|
42
|
+
def dogecoin(amount)
|
43
|
+
http('doge', 'usd', amount)
|
44
|
+
end
|
45
|
+
|
46
|
+
def ethereum(amount)
|
47
|
+
http('eth', 'usd', amount)
|
48
|
+
end
|
49
|
+
|
50
|
+
def ripple(amount)
|
51
|
+
http('xrp', 'usd', amount)
|
52
|
+
end
|
53
|
+
|
54
|
+
def tron(amount)
|
55
|
+
http('trx', 'usd', amount)
|
56
|
+
end
|
57
|
+
|
58
|
+
def tether(amount)
|
59
|
+
http('usdt', 'usd', amount)
|
60
|
+
end
|
61
|
+
|
62
|
+
def solana(amount)
|
63
|
+
http('sol', 'usd', amount)
|
64
|
+
end
|
65
|
+
|
66
|
+
def bitcoin_cash(amount)
|
67
|
+
http('bch', 'usd', amount)
|
68
|
+
end
|
69
|
+
|
70
|
+
def pepe(amount)
|
71
|
+
http('pepe', 'usd', amount)
|
72
|
+
end
|
73
|
+
|
74
|
+
def litecoin(amount)
|
75
|
+
http('ltc', 'usd', amount)
|
76
|
+
end
|
77
|
+
|
78
|
+
def polkadot(amount)
|
79
|
+
http('dot', 'usd', amount)
|
80
|
+
end
|
81
|
+
|
82
|
+
def chainlink(amount)
|
83
|
+
http('link', 'usd', amount)
|
84
|
+
end
|
85
|
+
|
86
|
+
def shiba_inu(amount)
|
87
|
+
http('shib', 'usd', amount)
|
88
|
+
end
|
89
|
+
|
90
|
+
def filecoin(amount)
|
91
|
+
http('fil', 'usd', amount)
|
92
|
+
end
|
93
|
+
|
94
|
+
def bat(amount)
|
95
|
+
http('bat', 'usd', amount)
|
96
|
+
end
|
97
|
+
|
98
|
+
def bnb(amount)
|
99
|
+
http('bnb', 'usd', amount)
|
100
|
+
end
|
101
|
+
|
102
|
+
def bonk(amount)
|
103
|
+
http('bonk', 'usd', amount)
|
104
|
+
end
|
105
|
+
|
106
|
+
def ravencoin(amount)
|
107
|
+
http('rvn', 'usd', amount)
|
108
|
+
endg
|
109
|
+
|
110
|
+
def usdc(amount)
|
111
|
+
http('usdc', 'usd', amount)
|
112
|
+
end
|
113
|
+
|
114
|
+
def cardano(amount)
|
115
|
+
http('ada', 'usd', amount)
|
116
|
+
end
|
117
|
+
|
118
|
+
def sui(amount)
|
119
|
+
http('sui', 'usd', amount)
|
120
|
+
end
|
121
|
+
|
122
|
+
def uniswap(amount)
|
123
|
+
http('uni', 'usd', amount)
|
124
|
+
end
|
125
|
+
|
126
|
+
def fantom(amount)
|
127
|
+
http('ftm', 'usd', amount)
|
128
|
+
end
|
129
|
+
|
130
|
+
def fartcoin(amount)
|
131
|
+
http('fartcoin', 'usd', amount)
|
132
|
+
end
|
133
|
+
|
134
|
+
def neo(amount)
|
135
|
+
http('neo', 'usd', amount)
|
136
|
+
end
|
137
|
+
|
138
|
+
def ftx_token(amount)
|
139
|
+
http('ftt', 'usd', amount)
|
140
|
+
end
|
141
|
+
|
142
|
+
def flow(amount)
|
143
|
+
http('flow', 'usd', amount)
|
144
|
+
end
|
145
|
+
|
146
|
+
def worldcoin(amount)
|
147
|
+
http('wld', 'usd', amount)
|
148
|
+
end
|
149
|
+
|
150
|
+
def vechain(amount)
|
151
|
+
http('vet', 'usd', amount)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
data/lib/CryptoPriceFinder.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative 'CryptoPriceFinder/version'
|
4
|
+
require_relative 'CryptoPriceFinder/crypto'
|
5
5
|
|
6
6
|
module CryptoPriceFinder
|
7
7
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CryptoPriceFinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael-Meade
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
description: Fetches Cryptocurrency prices from DuckDuckGo.
|
28
28
|
email:
|
29
29
|
- noway@lol.com
|
@@ -38,7 +38,7 @@ homepage: https://github.com/Michael-Meade/CryptoPriceFinder
|
|
38
38
|
licenses:
|
39
39
|
- Ruby
|
40
40
|
metadata: {}
|
41
|
-
post_install_message:
|
41
|
+
post_install_message:
|
42
42
|
rdoc_options: []
|
43
43
|
require_paths:
|
44
44
|
- lib
|
@@ -53,8 +53,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
|
-
rubygems_version: 3.
|
57
|
-
signing_key:
|
56
|
+
rubygems_version: 3.4.20
|
57
|
+
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Fetch Cryptocurrency prices from DuckDuckGo
|
60
60
|
test_files: []
|