money-coinmarketcap-bank 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 83b6668ba3bb114442aa216d2c401f16d690d8b6
4
- data.tar.gz: 46b28111fb02990f0d307a63f8beb937f2ef4a62
3
+ metadata.gz: ee21fe1a7437cdd09b1c5d329b54e59b9e6c3158
4
+ data.tar.gz: 3941adddb496555702b63ccd6276d5188e59e902
5
5
  SHA512:
6
- metadata.gz: fcb1a8b28f54441af37187705522bef2e618ca96dd63d6cbcd86922b3a8cbcb647c811f1dac57b31341552d297d7dc0f60f2356d9a861bc113b1e155f767828d
7
- data.tar.gz: 1d627d488780741e5a2f65302c9f69819e4a01e9a0edaf765b37d2cc26a819cb2ada55aad6ca6083dddd5f0a74d1b504ed9b1093d78063b6ce59f047616ea5d0
6
+ metadata.gz: 48dd8bcd993544bb4074dc7afefdefa9af74bb57cd8debb9fbde5494a81eab60374dea2bec1286ffb647a548df699a0c54aa6335dae1b3aa1ee07d6bd1c7eccd
7
+ data.tar.gz: 21b90d74f9206e619c746323e4238df86c2e783334ec6ffa4b347f1732821c1cb8bd13af71a6e44836ea5ba86b92bfbec449f786d8ed225c9074f0973a3b1e71
@@ -6,15 +6,12 @@ require "json"
6
6
  class Money
7
7
  module Bank
8
8
  class CoinMarketCap < Money::Bank::VariableExchange
9
- BASE_CURRENCY = "USD".freeze
9
+ BASE_CURRENCY = "BTC".freeze
10
10
  EXCHANGE_URL = "http://coinmarketcap.northpole.ro/api/v5/all.json".freeze
11
11
 
12
12
  # Seconds after which the current rates are automatically expired
13
13
  attr_accessor :ttl_in_seconds
14
14
 
15
- # Parsed UpholdBank result as a Hash
16
- attr_reader :tickers
17
-
18
15
  # Rates expiration time
19
16
  attr_reader :rates_expire_at
20
17
 
@@ -67,11 +64,15 @@ class Money
67
64
 
68
65
  def add_exchange_rates
69
66
  currencies.each do |currency|
67
+ next if currency['availableSupplyNumber'] == 0
68
+
70
69
  iso_from = currency['symbol']
71
70
  currency['price'].each do |iso_to, rate|
71
+ iso_to = iso_to.upcase
72
72
  next unless Money::Currency.find(iso_from) && Money::Currency.find(iso_to)
73
+
73
74
  add_rate(iso_from, iso_to, rate)
74
- add_rate(iso_to, iso_from, 1.0 / rate)
75
+ add_rate(iso_to, iso_from, 1.0 / rate) rescue binding.pry
75
76
  end
76
77
  end
77
78
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new { |s|
2
2
  s.name = 'money-coinmarketcap-bank'
3
- s.version = '0.1.2'
3
+ s.version = '0.1.3'
4
4
  s.author = 'Giovanni Capuano'
5
5
  s.email = 'webmaster@giovannicapuano.net'
6
6
  s.homepage = 'https://github.com/RoxasShadow'
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-coinmarketcap-bank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-07 00:00:00.000000000 Z
11
+ date: 2017-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6.9'
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
26
  version: '6.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '12.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '12.0'
41
41
  description: Attach this gem to ruby-money to use it as bank and get the exchange
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
48
+ - .gitignore
49
49
  - README.md
50
50
  - Rakefile
51
51
  - lib/money/bank/coin_market_cap.rb
@@ -60,17 +60,17 @@ require_paths:
60
60
  - lib
61
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ">="
63
+ - - '>='
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.6.12
73
+ rubygems_version: 2.0.14.1
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: CoinMarketCap frontend for ruby-money