bitcoin_to_usdt_exchange 2.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 65ed19212b9dd01da74306f15335bbeb82cf131f2a6ee85e55ab4b5ad6cca57a
4
+ data.tar.gz: 066f267ac4f8f9dc42eedadc6176cafb7cc45f3eb7ff84305ff580f4fac7603a
5
+ SHA512:
6
+ metadata.gz: e52d80eb551ad5f42f151a7fb9b03ba99a8f1b3f97b310d8d69577c22f22286a4374ec4efe4e131f76a9436eec6611458bbdb4b07cdcd52c4f6c12ac8dbcd47f
7
+ data.tar.gz: bcb9b6b23a9fb3a681940922cf2e6871f289981fcfa7921f3a1b21b4ba3f155f02f7824542b530ba088c695ad8b556ee8f6a1d0051242e5e9af178df528efce9
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # BitcoinToUsdtExchange
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/bitcoin_to_usdt_exchange`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_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_PRIOR_TO_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_PRIOR_TO_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]/bitcoin_to_usdt_exchange.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bitcoin_to_usdt_exchange/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bitcoin_to_usdt_exchange"
7
+ # spec.version = BitcoinToUsdtExchange::VERSION
8
+ spec.version = "2.0.0"
9
+ spec.authors = ["HuanCapital"]
10
+ spec.email = ["nguyenvanhuan243@gmail.com"]
11
+
12
+ spec.summary = "Bitcoin to usdts"
13
+ spec.description = "Bitcoin to usdts"
14
+ spec.homepage = "https://rubygems.org/"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ # spec.metadata["source_code_uri"] = "https://rubygems.org/"
21
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (File.expand_path(f) == __FILE__) ||
28
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
29
+ end
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ # Uncomment to register a new dependency of your gem
36
+ # spec.add_dependency "example-gem", "~> 1.0"
37
+
38
+ # For more information and examples about making a new gem, check out our
39
+ # guide at: https://bundler.io/guides/creating_gem.html
40
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BitcoinToUsdtExchange
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ require 'coinbase'
3
+ require 'usdt_wallet'
4
+ require_relative "bitcoin_to_usdt_exchange/version"
5
+
6
+ module BitcoinToUsdtExchange
7
+
8
+ class Converter
9
+ def initialize(api_key, api_secret)
10
+ @coinbase = Coinbase::Wallet.new(api_key, api_secret)
11
+ end
12
+
13
+ def bitcoin_to_usdt(amount_in_btc)
14
+ begin
15
+ bitcoin_price = @coinbase.price(currency: 'BTC-USD')
16
+ usd_price = @coinbase.price(currency: 'USDT-USD')
17
+ amount_in_usd = amount_in_btc * bitcoin_price.amount
18
+ amount_in_usdt = amount_in_usd / usd_price.amount
19
+ amount_in_usdt
20
+ rescue Coinbase::Wallet::APIError => e
21
+ raise "Error fetching exchange rates: #{e.message}"
22
+ end
23
+ end
24
+
25
+ def send_usdt(amount_in_usdt, recipient_address)
26
+ # Implement code to send USDT here using the usdt_wallet gem
27
+ end
28
+ end
29
+
30
+ class Error < StandardError; end
31
+ # Your code goes here...
32
+ end
@@ -0,0 +1,4 @@
1
+ module BitcoinToUsdtExchange
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitcoin_to_usdt_exchange
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - HuanCapital
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Bitcoin to usdts
14
+ email:
15
+ - nguyenvanhuan243@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README.md
21
+ - Rakefile
22
+ - bitcoin_to_usdt_exchange.gemspec
23
+ - lib/bitcoin_to_usdt_exchange.rb
24
+ - lib/bitcoin_to_usdt_exchange/version.rb
25
+ - sig/bitcoin_to_usdt_exchange.rbs
26
+ homepage: https://rubygems.org/
27
+ licenses: []
28
+ metadata:
29
+ homepage_uri: https://rubygems.org/
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: 2.6.0
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.2.3
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Bitcoin to usdts
49
+ test_files: []