currency-rate 2.0.0 → 2.0.3
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
- metadata +8 -119
- data/.document +0 -5
- data/.gitignore +0 -20
- data/.rspec +0 -1
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -68
- data/LICENSE.txt +0 -20
- data/README.md +0 -73
- data/Rakefile +0 -43
- data/currency-rate.gemspec +0 -41
- data/lib/adapter.rb +0 -100
- data/lib/adapters/crypto/binance_adapter.rb +0 -42
- data/lib/adapters/crypto/bitfinex_adapter.rb +0 -41
- data/lib/adapters/crypto/bitpay_adapter.rb +0 -29
- data/lib/adapters/crypto/bitstamp_adapter.rb +0 -26
- data/lib/adapters/crypto/coin_market_cap_adapter.rb +0 -29
- data/lib/adapters/crypto/coinbase_adapter.rb +0 -30
- data/lib/adapters/crypto/exmo_adapter.rb +0 -27
- data/lib/adapters/crypto/hit_BTC_adapter.rb +0 -64
- data/lib/adapters/crypto/huobi_adapter.rb +0 -25
- data/lib/adapters/crypto/kraken_adapter.rb +0 -46
- data/lib/adapters/crypto/localbitcoins_adapter.rb +0 -25
- data/lib/adapters/crypto/okcoin_adapter.rb +0 -17
- data/lib/adapters/crypto/paxful_adapter.rb +0 -18
- data/lib/adapters/crypto/poloniex_adapter.rb +0 -33
- data/lib/adapters/crypto/yadio_adapter.rb +0 -19
- data/lib/adapters/fiat/bonbast_adapter.rb +0 -23
- data/lib/adapters/fiat/coinmonitor_adapter.rb +0 -13
- data/lib/adapters/fiat/currency_layer_adapter.rb +0 -31
- data/lib/adapters/fiat/fixer_adapter.rb +0 -17
- data/lib/adapters/fiat/forge_adapter.rb +0 -34
- data/lib/adapters/fiat/free_forex_adapter.rb +0 -36
- data/lib/container.rb +0 -203
- data/lib/currency_rate.rb +0 -41
- data/lib/currency_rate/version.rb +0 -3
- data/lib/exceptions.rb +0 -9
- data/lib/storage/file_storage.rb +0 -34
- data/lib/storage/serializers/yaml_serializer.rb +0 -15
- data/lib/utils/string_extensions.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a10bc81c496c144edf8b648154d5814cfd73d9b5da9a1893822348321939ebba
|
4
|
+
data.tar.gz: 8d48c68cd5a87c763c5ae5f1620c81074b7b7122cf487f5288d8490c9e22e22e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd9bac11ce6a9c133d94d2f19bce9b0ce262bba3319cfa670ed1f92a7dbba3bcc2d49bcf20c4784eb3133bf29ea86d098305b3db0e62530bc3555f7f7143221
|
7
|
+
data.tar.gz: cf5b3d11df56c3fe9ca5718a3597b3518bba31aecc7d7c5688e163cd78901832c2db397663cfa12f9e549dfee9ece1a70233435427b244ac82f5ac1fd4dc3a11
|
metadata
CHANGED
@@ -1,135 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency-rate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- romanitup
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: http
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.3'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '4.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: byebug
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: webmock
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
83
13
|
description: Fetches exchange rates from various sources and does the conversion
|
84
|
-
email:
|
14
|
+
email: romanitup@protonmail.com
|
85
15
|
executables: []
|
86
16
|
extensions: []
|
87
17
|
extra_rdoc_files: []
|
88
|
-
files:
|
89
|
-
- ".document"
|
90
|
-
- ".gitignore"
|
91
|
-
- ".rspec"
|
92
|
-
- Gemfile
|
93
|
-
- Gemfile.lock
|
94
|
-
- LICENSE.txt
|
95
|
-
- README.md
|
96
|
-
- Rakefile
|
97
|
-
- currency-rate.gemspec
|
98
|
-
- lib/adapter.rb
|
99
|
-
- lib/adapters/crypto/binance_adapter.rb
|
100
|
-
- lib/adapters/crypto/bitfinex_adapter.rb
|
101
|
-
- lib/adapters/crypto/bitpay_adapter.rb
|
102
|
-
- lib/adapters/crypto/bitstamp_adapter.rb
|
103
|
-
- lib/adapters/crypto/coin_market_cap_adapter.rb
|
104
|
-
- lib/adapters/crypto/coinbase_adapter.rb
|
105
|
-
- lib/adapters/crypto/exmo_adapter.rb
|
106
|
-
- lib/adapters/crypto/hit_BTC_adapter.rb
|
107
|
-
- lib/adapters/crypto/huobi_adapter.rb
|
108
|
-
- lib/adapters/crypto/kraken_adapter.rb
|
109
|
-
- lib/adapters/crypto/localbitcoins_adapter.rb
|
110
|
-
- lib/adapters/crypto/okcoin_adapter.rb
|
111
|
-
- lib/adapters/crypto/paxful_adapter.rb
|
112
|
-
- lib/adapters/crypto/poloniex_adapter.rb
|
113
|
-
- lib/adapters/crypto/yadio_adapter.rb
|
114
|
-
- lib/adapters/fiat/bonbast_adapter.rb
|
115
|
-
- lib/adapters/fiat/coinmonitor_adapter.rb
|
116
|
-
- lib/adapters/fiat/currency_layer_adapter.rb
|
117
|
-
- lib/adapters/fiat/fixer_adapter.rb
|
118
|
-
- lib/adapters/fiat/forge_adapter.rb
|
119
|
-
- lib/adapters/fiat/free_forex_adapter.rb
|
120
|
-
- lib/container.rb
|
121
|
-
- lib/currency_rate.rb
|
122
|
-
- lib/currency_rate/version.rb
|
123
|
-
- lib/exceptions.rb
|
124
|
-
- lib/storage/file_storage.rb
|
125
|
-
- lib/storage/serializers/yaml_serializer.rb
|
126
|
-
- lib/utils/string_extensions.rb
|
18
|
+
files: []
|
127
19
|
homepage: https://gitlab.com/hodlhodl-public/currency-rate
|
128
20
|
licenses: []
|
129
|
-
metadata:
|
130
|
-
allowed_push_host: https://rubygems.org
|
131
|
-
homepage_uri: https://gitlab.com/hodlhodl-public/currency-rate
|
132
|
-
source_code_uri: https://gitlab.com/hodlhodl-public/currency-rate
|
21
|
+
metadata: {}
|
133
22
|
post_install_message:
|
134
23
|
rdoc_options: []
|
135
24
|
require_paths:
|
data/.document
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
currency-rate (1.7.0)
|
5
|
-
http (>= 4.3)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.7.0)
|
11
|
-
public_suffix (>= 2.0.2, < 5.0)
|
12
|
-
byebug (11.0.1)
|
13
|
-
crack (0.4.3)
|
14
|
-
safe_yaml (~> 1.0.0)
|
15
|
-
diff-lcs (1.3)
|
16
|
-
domain_name (0.5.20190701)
|
17
|
-
unf (>= 0.0.5, < 1.0.0)
|
18
|
-
ffi (1.13.1)
|
19
|
-
ffi-compiler (1.0.1)
|
20
|
-
ffi (>= 1.0.0)
|
21
|
-
rake
|
22
|
-
hashdiff (1.0.0)
|
23
|
-
http (4.4.1)
|
24
|
-
addressable (~> 2.3)
|
25
|
-
http-cookie (~> 1.0)
|
26
|
-
http-form_data (~> 2.2)
|
27
|
-
http-parser (~> 1.2.0)
|
28
|
-
http-cookie (1.0.3)
|
29
|
-
domain_name (~> 0.5)
|
30
|
-
http-form_data (2.3.0)
|
31
|
-
http-parser (1.2.1)
|
32
|
-
ffi-compiler (>= 1.0, < 2.0)
|
33
|
-
public_suffix (4.0.1)
|
34
|
-
rake (10.5.0)
|
35
|
-
rspec (3.9.0)
|
36
|
-
rspec-core (~> 3.9.0)
|
37
|
-
rspec-expectations (~> 3.9.0)
|
38
|
-
rspec-mocks (~> 3.9.0)
|
39
|
-
rspec-core (3.9.0)
|
40
|
-
rspec-support (~> 3.9.0)
|
41
|
-
rspec-expectations (3.9.0)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.9.0)
|
44
|
-
rspec-mocks (3.9.0)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.9.0)
|
47
|
-
rspec-support (3.9.0)
|
48
|
-
safe_yaml (1.0.5)
|
49
|
-
unf (0.1.4)
|
50
|
-
unf_ext
|
51
|
-
unf_ext (0.0.7.7)
|
52
|
-
webmock (3.7.6)
|
53
|
-
addressable (>= 2.3.6)
|
54
|
-
crack (>= 0.3.2)
|
55
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
56
|
-
|
57
|
-
PLATFORMS
|
58
|
-
ruby
|
59
|
-
|
60
|
-
DEPENDENCIES
|
61
|
-
byebug
|
62
|
-
currency-rate!
|
63
|
-
rake (~> 10.0)
|
64
|
-
rspec (~> 3.0)
|
65
|
-
webmock
|
66
|
-
|
67
|
-
BUNDLED WITH
|
68
|
-
2.1.2
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2016 Roman Snitko
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
currency-rate
|
2
|
-
=============
|
3
|
-
|
4
|
-
Converter for fiat and crypto currencies. Currently supports BTC and LTC.
|
5
|
-
|
6
|
-
Installation
|
7
|
-
------------
|
8
|
-
|
9
|
-
gem install currency-rate
|
10
|
-
|
11
|
-
or in Gemfile
|
12
|
-
|
13
|
-
gem "currency-rate"
|
14
|
-
|
15
|
-
Configuration
|
16
|
-
-------------
|
17
|
-
```ruby
|
18
|
-
CurrencyRate.configure do |config|
|
19
|
-
# Now only ForgeAdapter requires api key to fetch rates
|
20
|
-
# Empty array by default
|
21
|
-
config.api_keys["ForgeAdapter"] = "forge_api_key"
|
22
|
-
|
23
|
-
# CurrencyRate::FileStorage is built-in storage provider and has only `path` parameter
|
24
|
-
config.storage << CurrencyRate::FileStorage(path: "/home/user/data")
|
25
|
-
|
26
|
-
# CurrencyRate uses default Logger from Ruby core library
|
27
|
-
# It can be replaced with any compatible object
|
28
|
-
# All logger values listed below are default
|
29
|
-
config.logger[:device] = $stdout
|
30
|
-
config.logger[:level] = :info
|
31
|
-
config.logger[:formatter] = nil
|
32
|
-
|
33
|
-
# Cryptocurrency exchange adapters to fetch
|
34
|
-
config.crypto_adapters = ["Kraken", "Localbitcoins"]
|
35
|
-
|
36
|
-
# Fiat exchange adapters to fetch
|
37
|
-
config.fiat_adapters = ["Yahoo"]
|
38
|
-
end
|
39
|
-
```
|
40
|
-
|
41
|
-
Usage
|
42
|
-
-----
|
43
|
-
|
44
|
-
To fetch rates from exchanges into file storage (the only supported at this moment):
|
45
|
-
```ruby
|
46
|
-
CurrencyRate.sync!
|
47
|
-
```
|
48
|
-
This method will load all available data from exchanges and put into `yml` files. Failed exchanges will not create new / update exsisting files.
|
49
|
-
|
50
|
-
To get rates for Crypto/Fiat currency pair use:
|
51
|
-
```ruby
|
52
|
-
CurrencyRate.fetch_crypto("Bitstamp", "BTC", "USD")
|
53
|
-
```
|
54
|
-
|
55
|
-
For fetching Fiat/Fiat pair:
|
56
|
-
```ruby
|
57
|
-
CurrencyRate.fetch_fiat("CNY", "USD")
|
58
|
-
```
|
59
|
-
|
60
|
-
Details
|
61
|
-
-------
|
62
|
-
|
63
|
-
`CurrencyRate` contains two parts that can work independently: Synchronizer and Fetcher.
|
64
|
-
`CurrencyRate::Synchronizer` loads data from selected exchanges using adapters and saves it into FileStorage in normalized format.
|
65
|
-
`CurrencyRate::Fetch` reads data from FileStorage and returns rate for requested pair and exchange.
|
66
|
-
|
67
|
-
Development
|
68
|
-
-----------
|
69
|
-
When adapter's output format changes you can replace fixtures by running `bin/rake update_rates['ExchangeName']`.
|
70
|
-
For example `bin/rake update_rates['Fixer']` will update fixtures for the FixerAdapter.
|
71
|
-
|
72
|
-
Some of adapters require API keys so the task searches for 'api_keys.yml` file in project root.
|
73
|
-
You can copy it from `api_keys.yml.sample` and set up your values.
|
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'byebug'
|
2
|
-
require 'yaml'
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
require "rspec/core/rake_task"
|
5
|
-
require_relative "lib/currency_rate"
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
|
9
|
-
task :default => :spec
|
10
|
-
|
11
|
-
desc "Update rates for specified adapter"
|
12
|
-
task :update_rates, [:exchange] do |_, args|
|
13
|
-
api_keys = YAML.load_file("api_keys.yml")
|
14
|
-
|
15
|
-
CurrencyRate.configure do |config|
|
16
|
-
api_keys.each { |name, key| config.api_keys[name] = key }
|
17
|
-
end
|
18
|
-
|
19
|
-
adapter = CurrencyRate::const_get("#{args.exchange}Adapter").instance
|
20
|
-
|
21
|
-
print "Loading data for #{args.exchange}... "
|
22
|
-
exchange_data = adapter.exchange_data
|
23
|
-
raw_storage = CurrencyRate::FileStorage.new(path: File.expand_path("spec/fixtures/adapters", __dir__))
|
24
|
-
raw_storage.write(args.exchange, exchange_data)
|
25
|
-
puts "Success!"
|
26
|
-
|
27
|
-
print "Normalizing data for #{args.exchange}..."
|
28
|
-
normalized_data = adapter.normalize exchange_data
|
29
|
-
normalized_storage = CurrencyRate::FileStorage.new(path: File.expand_path("spec/fixtures/adapters/normalized", __dir__))
|
30
|
-
normalized_storage.write(args.exchange, normalized_data)
|
31
|
-
puts "Success!"
|
32
|
-
|
33
|
-
puts "#{args.exchange} fixtures update finished!"
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Update rates for all defined adapters"
|
37
|
-
task :update_all_rates do |_, _|
|
38
|
-
CurrencyRate.constants.grep(/.Adapter$/).each do |name|
|
39
|
-
short_name = name.to_s.sub("Adapter", "")
|
40
|
-
Rake::Task[:update_rates].invoke(short_name)
|
41
|
-
Rake::Task[:update_rates].reenable
|
42
|
-
end
|
43
|
-
end
|
data/currency-rate.gemspec
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "currency_rate/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "currency-rate"
|
7
|
-
spec.version = CurrencyRate::VERSION
|
8
|
-
spec.authors = ["Roman Snitko"]
|
9
|
-
spec.email = "roman.snitko@gmail.com"
|
10
|
-
|
11
|
-
spec.summary = "Converter for fiat and crypto currencies"
|
12
|
-
spec.description = "Fetches exchange rates from various sources and does the conversion"
|
13
|
-
spec.homepage = "https://gitlab.com/hodlhodl-public/currency-rate"
|
14
|
-
|
15
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
-
if spec.respond_to?(:metadata)
|
18
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = "https://gitlab.com/hodlhodl-public/currency-rate"
|
22
|
-
else
|
23
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
-
"public gem pushes."
|
25
|
-
end
|
26
|
-
|
27
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
-
end
|
30
|
-
spec.bindir = "exe"
|
31
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ["lib"]
|
33
|
-
|
34
|
-
spec.add_dependency "http", ">= 4.3"
|
35
|
-
|
36
|
-
spec.add_development_dependency "byebug"
|
37
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
38
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
39
|
-
spec.add_development_dependency "webmock"
|
40
|
-
end
|
41
|
-
|