CryptoPriceFinder 0.6.0 → 0.6.2

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