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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2985884072fbb0fcf5947b15e93ea59842733b673814672c7967033316a92a2d
4
- data.tar.gz: 6643e833eb55937b87112dea847a1b6589b13ccb38222b98543a958a0d58b0df
3
+ metadata.gz: e6405b08fa49e388d97bb81881ff2dd70e0773ff1716be77a204725d03ede3da
4
+ data.tar.gz: 0b42580ffc8c61b628f06faf7e640aa6738ab046f063f7025e696898c2115fa6
5
5
  SHA512:
6
- metadata.gz: 3eaed93abbf567fc875c3f4819c4283cfe273ea16896ffa148bd819297eb9ba819c35e23df6684c059f55d2ce2df430979afbfd6df394ede22c92a5ff252ab6e
7
- data.tar.gz: 9b9cca50fd27f83b90d1923d40e6cb9d3e7c6cb0d42b13b705717a7cb442ea876679b50e8fd77ee62f7c33c65da65a2320761480a70d00847fa95470e18bcd2e
6
+ metadata.gz: 30ed7a48ff5e9e35c26d3d63273423d8840c4a7462793e0c18d5953e2567410da90e49fba27a3c9954207591e8cf6420f95458f8f72b02d7a7a39d35286f0b65
7
+ data.tar.gz: c8f3febfb03580fcdf736597f43a2172740837a1895838e9d13b11c922f1b35ead1a784eb584f6ce8475a6899d602760808a4395ca38c96b9759200c7ea849c0
@@ -1,113 +1,154 @@
1
- require 'json'
2
- require 'httparty'
3
-
4
- module CryptoPriceFinder
5
- class << self
6
- URL = "https://duckduckgo.com/js/spice/cryptocurrency/"
7
- def clean(input)
8
- input.gsub("ddg_spice_cryptocurrency(", "").gsub(");", "").strip
9
- end
10
- private
11
- def http(crypto, fiat, amount)
12
- r = HTTParty.get(File.join(URL, crypto, fiat, amount.to_s)).body
13
- r_clean = clean(r)
14
- json = JSON.parse(r_clean)["data"]["quote"]
15
- q = json.keys.shift.to_s
16
- json[q]["price"].round(4)
17
- end
18
- public
19
- def monero(amount)
20
- http("xmr", "usd", amount)
21
- end
22
- def stellar(amount)
23
- http("xlm", "usd", amount)
24
- end
25
- def bitcoin(amount)
26
- http("btc", "usd", amount)
27
- end
28
- def dogecoin(amount)
29
- http("doge", "usd", amount)
30
- end
31
- def ethereum(amount)
32
- http("eth", "usd", amount)
33
- end
34
- def ripple(amount)
35
- http("xrp", "usd", amount)
36
- end
37
- def tron(amount)
38
- http("trx", "usd", amount)
39
- end
40
- def tether(amount)
41
- http("usdt", "usd", amount)
42
- end
43
- def solana(amount)
44
- http("sol", "usd", amount)
45
- end
46
- def bitcoin_cash(amount)
47
- http("bch", "usd", amount)
48
- end
49
- def pepe(amount)
50
- http("pepe", "usd", amount)
51
- end
52
- def litecoin(amount)
53
- http("ltc", "usd", amount)
54
- end
55
- def polkadot(amount)
56
- http("dot", "usd", amount)
57
- end
58
- def chainlink(amount)
59
- http("link", "usd", amount)
60
- end
61
- def shiba_inu(amount)
62
- http("shib", "usd", amount)
63
- end
64
- def filecoin(amount)
65
- http("fil", "usd", amount)
66
- end
67
- def bat(amount)
68
- http("bat", "usd", amount)
69
- end
70
- def bnb(amount)
71
- http("bnb", "usd", amount)
72
- end
73
- def bonk(amount)
74
- http("bonk", "usd", amount)
75
- end
76
- def ravencoin(amount)
77
- http("rvn", "usd", amount)
78
- end
79
- def usdc(amount)
80
- http("usdc", "usd", amount)
81
- end
82
- def cardano(amount)
83
- http("ada", "usd", amount)
84
- end
85
- def sui(amount)
86
- http("sui", "usd", amount)
87
- end
88
- def uniswap(amount)
89
- http("uni", "usd", amount)
90
- end
91
- def fantom(amount)
92
- http("ftm", "usd", amount)
93
- end
94
- def fartcoin(amount)
95
- http("fartcoin", "usd", amount)
96
- end
97
- def neo(amount)
98
- http("neo", "usd", amount)
99
- end
100
- def ftx_token(amount)
101
- http("ftt", "usd", amount)
102
- end
103
- def flow(amount)
104
- http("flow", "usd", amount)
105
- end
106
- def worldcoin(amount)
107
- http("wld", "usd", amount)
108
- end
109
- def vechain(amount)
110
- http("vet", "usd", amount)
111
- end
112
- end
113
- end
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CryptoPriceFinder
4
- VERSION = "0.5.0"
4
+ VERSION = '0.6.1'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "CryptoPriceFinder/version"
4
- require_relative "CryptoPriceFinder/crypto"
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.5.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-01-04 00:00:00.000000000 Z
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.22.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.22.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.3.5
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: []