arbolito 0.3.0 → 0.3.1
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
- data/arbolito.gemspec +1 -1
- data/lib/arbolito/exchange/yahoo_finance.rb +26 -26
- data/lib/arbolito/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eb7debcbbd8a4e8ae2a6affe9388c18be6d639c
|
4
|
+
data.tar.gz: eb4c652aab767c46cd192c4f644949c37327cd8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd9267d12fff2f7ccbe2bb028bcf224f2bae6f8c544ead62812d08a84bbdf0b8d24869f7fce02e3beca6a721f21e931faba513b0f2470dc2d9755caa79dd9ba
|
7
|
+
data.tar.gz: 1ecae9413826f55e8173685047e4bc8749ddc632ff0b61735aff3952f83de48c6453309ce6e675e9422c9f3530bd9e41d2e3f07386d77d0b45759f4dbdd79b9c
|
data/arbolito.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["contact@jonvillage.com"]
|
11
11
|
|
12
12
|
s.summary = "A currency conversion api for the minimalist developer"
|
13
|
-
s.description = s
|
13
|
+
s.description = "A currency conversion that fetch from external source and also let's you add a fixed rate for different currencies"
|
14
14
|
s.homepage = "https://github.com/jvillarejo/arbolito.git"
|
15
15
|
s.license = "MIT"
|
16
16
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -3,37 +3,37 @@ require 'net/http'
|
|
3
3
|
module Arbolito
|
4
4
|
module Exchange
|
5
5
|
class YahooFinance
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
data = response(build_uri(quote))
|
6
|
+
class << self
|
7
|
+
# DEPRECATED Yahoo Finance is not supported anymore by Yahoo so use Alpha Vantage API
|
8
|
+
def find_current_rate(quote)
|
9
|
+
warn "[DEPRECATION] Yahoo Finance `find_current_rate` is deprecated. Please use AlphaVantage `find_current_rate` instead."
|
10
|
+
data = response(build_uri(quote))
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
values = {
|
13
|
+
quote: quote,
|
14
|
+
price: data[1],
|
15
|
+
}
|
17
16
|
|
18
|
-
|
19
|
-
|
17
|
+
build_rate(values)
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
private
|
21
|
+
def response(uri)
|
22
|
+
response = Net::HTTP.get(uri)
|
23
|
+
data = response.gsub(/"|\\n/,'').split(',')
|
24
|
+
end
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
def build_uri(quote)
|
27
|
+
param = "#{quote.from.upcase}#{quote.to.upcase}"
|
28
|
+
URI("http://download.finance.yahoo.com/d/quotes.csv?s=#{param}=X&f=nl1d1t1")
|
29
|
+
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
def build_rate(values)
|
32
|
+
Currency::Rate.new(
|
33
|
+
values[:price],
|
34
|
+
values[:quote].to_hash
|
35
|
+
)
|
36
|
+
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/arbolito/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arbolito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jvillarejo
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.10'
|
69
|
-
description: A currency conversion
|
69
|
+
description: A currency conversion that fetch from external source and also let's
|
70
|
+
you add a fixed rate for different currencies
|
70
71
|
email:
|
71
72
|
- contact@jonvillage.com
|
72
73
|
executables: []
|