currency-rate 1.5.4 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. metadata +9 -122
  3. data/.document +0 -5
  4. data/.gitignore +0 -22
  5. data/.rspec +0 -1
  6. data/Gemfile +0 -6
  7. data/LICENSE.txt +0 -20
  8. data/README.md +0 -73
  9. data/Rakefile +0 -34
  10. data/api_keys.yml.sample +0 -4
  11. data/bin/rake +0 -29
  12. data/bin/rspec +0 -29
  13. data/currency-rate.gemspec +0 -41
  14. data/lib/adapter.rb +0 -66
  15. data/lib/adapters/crypto/binance_adapter.rb +0 -42
  16. data/lib/adapters/crypto/bitfinex_adapter.rb +0 -40
  17. data/lib/adapters/crypto/bitpay_adapter.rb +0 -29
  18. data/lib/adapters/crypto/bitstamp_adapter.rb +0 -26
  19. data/lib/adapters/crypto/btc_china_adapter.rb +0 -11
  20. data/lib/adapters/crypto/btc_e_adapter.rb +0 -18
  21. data/lib/adapters/crypto/coin_market_cap_adapter.rb +0 -31
  22. data/lib/adapters/crypto/coinbase_adapter.rb +0 -30
  23. data/lib/adapters/crypto/exmo_adapter.rb +0 -27
  24. data/lib/adapters/crypto/huobi_adapter.rb +0 -17
  25. data/lib/adapters/crypto/kraken_adapter.rb +0 -46
  26. data/lib/adapters/crypto/localbitcoins_adapter.rb +0 -25
  27. data/lib/adapters/crypto/okcoin_adapter.rb +0 -19
  28. data/lib/adapters/crypto/yadio_adapter.rb +0 -19
  29. data/lib/adapters/fiat/bonbast_adapter.rb +0 -25
  30. data/lib/adapters/fiat/coinmonitor_adapter.rb +0 -14
  31. data/lib/adapters/fiat/currency_layer_adapter.rb +0 -32
  32. data/lib/adapters/fiat/fixer_adapter.rb +0 -18
  33. data/lib/adapters/fiat/forge_adapter.rb +0 -25
  34. data/lib/adapters/fiat/free_forex_adapter.rb +0 -32
  35. data/lib/adapters/fiat/yahoo_adapter.rb +0 -35
  36. data/lib/configuration.rb +0 -29
  37. data/lib/currency_rate.rb +0 -84
  38. data/lib/currency_rate/version.rb +0 -3
  39. data/lib/fetcher.rb +0 -78
  40. data/lib/storage/file_storage.rb +0 -29
  41. data/lib/storage/serializers/yaml_serializer.rb +0 -15
  42. data/lib/synchronizer.rb +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ea85ddb7aed559684e8dd54fd3bdaa422ee93ee806971dd96f492edda1d61c7
4
- data.tar.gz: e766fecac778210f232721c5a64e023963714829b352222f19d11c5132a8c82d
3
+ metadata.gz: a10bc81c496c144edf8b648154d5814cfd73d9b5da9a1893822348321939ebba
4
+ data.tar.gz: 8d48c68cd5a87c763c5ae5f1620c81074b7b7122cf487f5288d8490c9e22e22e
5
5
  SHA512:
6
- metadata.gz: 256e3760059f1a5f60fbea8885d623e84660be15e785bbb72c5b0c69deed48ebb0d952135bea97de560bcf5aaed3acadefcd28efecb05bd9b784712d950eaf9f
7
- data.tar.gz: 7df86a15080699489c0c3607c8893df85e04f534c1176528e0b3280a79764cc82755a6521548ca0f7a44d1c9d569f957d27b6a6fcc1c871b4bf1593b5d6523a6
6
+ metadata.gz: abd9bac11ce6a9c133d94d2f19bce9b0ce262bba3319cfa670ed1f92a7dbba3bcc2d49bcf20c4784eb3133bf29ea86d098305b3db0e62530bc3555f7f7143221
7
+ data.tar.gz: cf5b3d11df56c3fe9ca5718a3597b3518bba31aecc7d7c5688e163cd78901832c2db397663cfa12f9e549dfee9ece1a70233435427b244ac82f5ac1fd4dc3a11
metadata CHANGED
@@ -1,137 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency-rate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - Roman Snitko
7
+ - romanitup
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-27 00:00:00.000000000 Z
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: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
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: roman.snitko@gmail.com
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
- - LICENSE.txt
94
- - README.md
95
- - Rakefile
96
- - api_keys.yml.sample
97
- - bin/rake
98
- - bin/rspec
99
- - currency-rate.gemspec
100
- - lib/adapter.rb
101
- - lib/adapters/crypto/binance_adapter.rb
102
- - lib/adapters/crypto/bitfinex_adapter.rb
103
- - lib/adapters/crypto/bitpay_adapter.rb
104
- - lib/adapters/crypto/bitstamp_adapter.rb
105
- - lib/adapters/crypto/btc_china_adapter.rb
106
- - lib/adapters/crypto/btc_e_adapter.rb
107
- - lib/adapters/crypto/coin_market_cap_adapter.rb
108
- - lib/adapters/crypto/coinbase_adapter.rb
109
- - lib/adapters/crypto/exmo_adapter.rb
110
- - lib/adapters/crypto/huobi_adapter.rb
111
- - lib/adapters/crypto/kraken_adapter.rb
112
- - lib/adapters/crypto/localbitcoins_adapter.rb
113
- - lib/adapters/crypto/okcoin_adapter.rb
114
- - lib/adapters/crypto/yadio_adapter.rb
115
- - lib/adapters/fiat/bonbast_adapter.rb
116
- - lib/adapters/fiat/coinmonitor_adapter.rb
117
- - lib/adapters/fiat/currency_layer_adapter.rb
118
- - lib/adapters/fiat/fixer_adapter.rb
119
- - lib/adapters/fiat/forge_adapter.rb
120
- - lib/adapters/fiat/free_forex_adapter.rb
121
- - lib/adapters/fiat/yahoo_adapter.rb
122
- - lib/configuration.rb
123
- - lib/currency_rate.rb
124
- - lib/currency_rate/version.rb
125
- - lib/fetcher.rb
126
- - lib/storage/file_storage.rb
127
- - lib/storage/serializers/yaml_serializer.rb
128
- - lib/synchronizer.rb
18
+ files: []
129
19
  homepage: https://gitlab.com/hodlhodl-public/currency-rate
130
20
  licenses: []
131
- metadata:
132
- allowed_push_host: https://rubygems.org
133
- homepage_uri: https://gitlab.com/hodlhodl-public/currency-rate
134
- source_code_uri: https://gitlab.com/hodlhodl-public/currency-rate
21
+ metadata: {}
135
22
  post_install_message:
136
23
  rdoc_options: []
137
24
  require_paths:
@@ -147,7 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
34
  - !ruby/object:Gem::Version
148
35
  version: '0'
149
36
  requirements: []
150
- rubygems_version: 3.0.3
37
+ rubygems_version: 3.1.2
151
38
  signing_key:
152
39
  specification_version: 4
153
40
  summary: Converter for fiat and crypto currencies
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- # rcov generated
2
- coverage
3
- coverage.data
4
-
5
- # rdoc generated
6
- rdoc
7
-
8
- # yard generated
9
- doc
10
- .yardoc
11
-
12
- # bundler
13
- .bundle
14
-
15
- pkg
16
-
17
- .byebug_history
18
-
19
- Gemfile.lock
20
-
21
- # Private API keys for adapters
22
- api_keys.yml
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in currency-rate.gemspec
6
- gemspec
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 configuration has only 'path' attribute
24
- config.file_storage[:path] = "/home/user/data" # default: ""
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,34 +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 |t, 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(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(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
data/api_keys.yml.sample DELETED
@@ -1,4 +0,0 @@
1
- ForgeAdapter: "<your_key>"
2
- CurrencyLayerAdapter: "<your_key>"
3
- FixerAdapter: "<your_key>"
4
- CoinMarketCapAdapter: "<your_key>"
data/bin/rake DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rake' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rake", "rake")
data/bin/rspec DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rspec-core", "rspec")
@@ -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", ">= 0"
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
-