justexchangerates 0.3.0 → 0.4.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 +5 -5
- checksums.yaml.gz.sig +1 -1
- data.tar.gz.sig +0 -0
- data/lib/justexchangerates.rb +36 -2
- metadata +49 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6cc728376fd613e145e8a5e25260793d42c180fc4371c5ca9fe8e5a2ec813a72
|
4
|
+
data.tar.gz: 8d6484ee483c96357f473433f3130b8fc716fdbe17416394496df61f6e94f45a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b360cc811faaf3373152083403d5f16eab461c3c206e9781d9b6536fac4df94c1b3619f03550974f1ca3cb8e0f4b19803180ca47012d027bd79f9f17bef6bfa
|
7
|
+
data.tar.gz: 615440723123c9659e39e4139c99ee1a498a246bf05882f12f998bde735453a5b7cc6eef00059f2ff99df3677c12da808f24483e48c8c0a9ca57e456ace3c688
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
�7��.x�O��JMg�3Ŕ1��!��P��@x���������$]j\e��i�B�)4k7��3��"7�~�9\G�y%߭�پ�����,����Y��4��"64��H ;g���C��G"L������H0ԍ���z�[�Cr�b5�����_]�?�������Ӏ�t�;�g���>i|"��J��u��B!A\�֍�I�����.�m�л��{;�� ܔgؙL/1���4LS-�p|�2ʘ�,�\��.7�U�V��;tB �S6xܑ5Ut0Jo�}T\!�J���NH��8�al|��5�'��Zj.�8D�m��
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/justexchangerates.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
require 'json'
|
6
6
|
require 'open-uri'
|
7
7
|
require 'chronic_duration'
|
8
|
+
require 'dynarex-password' # used by JustExchangeRatesPlus
|
8
9
|
require 'open_exchange_rates'
|
9
10
|
|
10
11
|
|
@@ -68,9 +69,11 @@ class JustExchangeRates
|
|
68
69
|
def fetch_rate(currency)
|
69
70
|
|
70
71
|
puts 'inside fetch_rate' if @debug
|
71
|
-
|
72
|
+
puts '@app_id: ' + @app_id.inspect if @debug
|
73
|
+
|
74
|
+
rate = OpenExchangeRates::Rates.new(app_id: @app_id)\
|
75
|
+
.exchange_rate(from: @base, to: currency)
|
72
76
|
|
73
|
-
rate = fx.convert(1, :from => "USD", :to => currency)
|
74
77
|
puts "currency: %s rate: %s" % [currency, rate] if @debug
|
75
78
|
|
76
79
|
@rates[currency.upcase.to_sym] = [rate, Time.now.to_s]
|
@@ -81,3 +84,34 @@ class JustExchangeRates
|
|
81
84
|
end
|
82
85
|
|
83
86
|
end
|
87
|
+
|
88
|
+
class JustExchangeRatesPlus < JustExchangeRates
|
89
|
+
|
90
|
+
|
91
|
+
def initialize(reg, base: 'USD', cache_refresh: '1 week', cache_path: '.', \
|
92
|
+
debug: false)
|
93
|
+
|
94
|
+
@debug = debug
|
95
|
+
|
96
|
+
key = 'hkey_apps/justexchangerates'
|
97
|
+
e = reg.get_key(key)
|
98
|
+
@lookup_file = e.text('lookup_file').to_s
|
99
|
+
|
100
|
+
app_id = decipher(e.text('app_id').to_s)
|
101
|
+
|
102
|
+
if @debug then
|
103
|
+
puts app_id.inspect
|
104
|
+
end
|
105
|
+
|
106
|
+
super(base: 'USD', cache_refresh: '1 week', cache_path: '.', \
|
107
|
+
debug: debug, app_id: app_id)
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def decipher(s)
|
114
|
+
DynarexPassword.new.reverse_lookup(s, @lookup_file)
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justexchangerates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,53 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwNTAzMTAwMjAyWhcN
|
15
|
+
MjIwNTAzMTAwMjAyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDW6d4n
|
17
|
+
cFvhD60eRKa63NtM7MloEknlEnC9rxjXcYtDRNIpQJxtKV+YUzFNoiEXYPCqMUlK
|
18
|
+
kiY0BUiW2a/ngsSrIS8c7H9K25zxeM80kmaD0lP+mjD9T/VKwo57R9NfxkggNyPu
|
19
|
+
LsePUD1zskUO0couKY79sr7Qj1P/BkLYJCdRbb27hC2bb8vioACK5ScwBlelaTJu
|
20
|
+
I/oiSQ5DVve6trYymqqn/NCxACN/WEO5VCIYAddixqLtU8YBfPrWl7xbKoZXl0pP
|
21
|
+
mECME0dnlpFPnRDtYivKlnDVVuJ9eASxHLpTY1ihJNKnmlhNANq1b42/Jp7XQS+L
|
22
|
+
UKeKnAuqWnq6J37THteVJZIJ1tn574qeTLO4hpVHgK05ZHswJf4r7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 Z
|
34
39
|
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: dynarex-password
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.2.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.2'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.2.0
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.2'
|
35
60
|
- !ruby/object:Gem::Dependency
|
36
61
|
name: chronic_duration
|
37
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +98,7 @@ dependencies:
|
|
73
98
|
- !ruby/object:Gem::Version
|
74
99
|
version: 0.5.1
|
75
100
|
description:
|
76
|
-
email:
|
101
|
+
email: digital.robertson@gmail.com
|
77
102
|
executables: []
|
78
103
|
extensions: []
|
79
104
|
extra_rdoc_files: []
|
@@ -99,8 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
124
|
version: '0'
|
100
125
|
requirements: []
|
101
126
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.7.10
|
103
128
|
signing_key:
|
104
129
|
specification_version: 4
|
105
|
-
summary: Fetches the latest exchange rates using the
|
130
|
+
summary: Fetches the latest exchange rates using the open_exchange_rates gem.
|
106
131
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|