CryptoPriceFinder 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 637e6eb337c16695571354274a59b1dfab940dcf6ee86dd882546be9e8d1b9f7
4
- data.tar.gz: ec57fb5feff88d415442c7ea4b41c03104a0f72071a86226f6efb6a0311232e2
3
+ metadata.gz: 9328ebe22ba165216244abb489809a2081c797a8fd75a14105660a9c1ac1b26a
4
+ data.tar.gz: 4eb5f1e22538f3315ab7a9a04dd6dc7507b7971cc3c0e524240766492ca33831
5
5
  SHA512:
6
- metadata.gz: ff8e0f828e468b2af8a23d8735f91896a8bd3acde09596a7eb6d5c94fdb0aa59e46d2f4bc6effa1120ac3c9301aa39778c36c178ada1dfe2c492cafc7f67b8ae
7
- data.tar.gz: 95fb014ff90a36e453f118852dc4f9c90080e68f85f59aa4c2646e56a606b90258d9992f7c2f98fcd2b429c77c8aceaafefa16a288eaaba64f0f048b96cc6ad3
6
+ metadata.gz: c448b6e677682f326e4d26bf90ebb8126f715bb874958a6d6390b66b0b31a8bae6379df7bc8da5801250f08e5c5089bd2fa69069e1869bf99af778b31746047e
7
+ data.tar.gz: a5b519d97844234cf37894f95d4ea8c7d0e886771101bbc2e8fe2ee85c4ca98744146b33c269b7d51677fc8dfa2f7264c19c7b12f7d0eb2134746088c27c3bc1
@@ -0,0 +1,83 @@
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 grin(amount)
80
+ http("grin", "usd", amount)
81
+ end
82
+ end
83
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CryptoPriceFinder
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  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.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael-Meade
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-02 00:00:00.000000000 Z
11
+ date: 2025-01-03 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: '1.0'
19
+ version: 0.22.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: '1.0'
26
+ version: 0.22.0
27
27
  description: Fetches Cryptocurrency prices from DuckDuckGo.
28
28
  email:
29
29
  - noway@lol.com
@@ -31,12 +31,10 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - README.md
35
- - Rakefile
36
34
  - lib/CryptoPriceFinder.rb
35
+ - lib/CryptoPriceFinder/crypto.rb
37
36
  - lib/CryptoPriceFinder/version.rb
38
- - sig/CryptoPriceFinder.rbs
39
- homepage:
37
+ homepage: https://github.com/Michael-Meade/CryptoPriceFinder
40
38
  licenses:
41
39
  - Ruby
42
40
  metadata: {}
data/README.md DELETED
@@ -1,31 +0,0 @@
1
- # CryptoPriceFinder
2
-
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/CryptoPriceFinder`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
-
25
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
-
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
-
29
- ## Contributing
30
-
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/CryptoPriceFinder.
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- task default: %i[]
@@ -1,4 +0,0 @@
1
- module CryptoPriceFinder
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end