justexchangerates 0.3.1 → 0.4.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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/justexchangerates.rb +36 -2
- metadata +48 -23
- 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: 8103ad3c7e9e32737fae9535b6b10d3d832dade5fa2da615a9fd7f1f8ef6d646
|
4
|
+
data.tar.gz: 10373ee12ed1c673e2d58421da6187f77d0b0f79bb25ea12d5a798b6c9f3ce24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d32a946890cc15941752ee4aa375e04a9da9b51661b55e0f674805c99546cfdd21625c34b10a3a24562829d5843f039664faf6f6bd3709b6d475a4b1db3a698c
|
7
|
+
data.tar.gz: 9554e5d8f4aa8dd217eb40f36cb4e7468b61dab9048312bd25b346cd5866158e86316fa08e0509eb7ba536f1d81d1447d55c65debba27e9312535982b7b4459a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
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
|
+
def self.fetch_app_id(reg)
|
91
|
+
|
92
|
+
decipher = ->(lookup_file, s) {
|
93
|
+
DynarexPassword.new.reverse_lookup(s, lookup_file)
|
94
|
+
}
|
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.call(lookup_file, e.text('app_id').to_s)
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
def initialize(reg, base: 'USD', cache_refresh: '1 week', cache_path: '.', \
|
106
|
+
debug: false)
|
107
|
+
|
108
|
+
@debug = debug
|
109
|
+
|
110
|
+
app_id = JustExchangeRatesPlus.fetch_app_id(reg)
|
111
|
+
|
112
|
+
super(base: 'USD', cache_refresh: '1 week', cache_path: '.', \
|
113
|
+
debug: debug, app_id: app_id)
|
114
|
+
end
|
115
|
+
|
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.1
|
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
|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HQ4EFgQUABvnXdqz
|
26
|
+
neWCc/rJbHFU2PSxfvUwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAGY+2a/R8otnOe3prMpoi33L3Zoy6uV60S+zzNdTN
|
29
|
+
DqFFwerdq+C5nmHfdffG0xCpLgRvHhXgBx7q1LmoKfLINFZEYzYNgNqL0xzv5nlP
|
30
|
+
awmuaLENq3AInjbtBTpb13OJ5KJjYZ3qhQUSXVv+5zMtRAOZNjgb/qM5FpooM8+B
|
31
|
+
KW8ZM9H7YsRCQn6+ufN4zLc4QjJfgoK17+mNl3DeGENaLFygOm5uzGcoXUI1dGIY
|
32
|
+
nCxB6LEW6e7+UPCDMp4GKgK0QA5pCf8eR9nTEDhvZA8GNLiHO8n1vkCsVCgBtWPR
|
33
|
+
qFw6Mug5QcTMnpyzF9WJ6HGlDcefBpjAzGPibP9qLlFvxYSofFUhYl72dIZyJ8Cg
|
34
|
+
wwirVUOBgWnpWF8THFG8m/pp/ZhhbBn6mlS0XR4Z+7rAzzvviQvBg54jPduk5h2z
|
35
|
+
7DV4V4ArjIvHVPFk1NBNtMTP9/u5jcFbnXRm0K1puvzAOu94LU7xzQj+eRmUCOiL
|
36
|
+
Egnradf17FANvSHDTppAf9Pz
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2021-05-04 00:00:00.000000000 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,7 +124,7 @@ 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
130
|
summary: Fetches the latest exchange rates using the open_exchange_rates gem.
|
metadata.gz.sig
CHANGED
Binary file
|