justexchangerates 0.3.1 → 0.4.1

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
- SHA1:
3
- metadata.gz: fb38066ddb7948ed6ea204025ac736f0938193af
4
- data.tar.gz: ece99c3563e6abcf52681b5a6e0fe15633d15d97
2
+ SHA256:
3
+ metadata.gz: 8103ad3c7e9e32737fae9535b6b10d3d832dade5fa2da615a9fd7f1f8ef6d646
4
+ data.tar.gz: 10373ee12ed1c673e2d58421da6187f77d0b0f79bb25ea12d5a798b6c9f3ce24
5
5
  SHA512:
6
- metadata.gz: 5acace682d33fdbdaa40575b471ab830f4c6ac061ea8de79222ddb3d205d14997ab0f8f0bac9653e9bcb592bd8606e9ab08fd6d636ac1d3718b7dd73eecbb9f6
7
- data.tar.gz: ddc138bde045aff2e989ff252dd02fafdfcd53e979d4be38fdb856d8ab6e4169355bf8d0c21978b5f544e5ee5d0baf1d5a46efc55a3f3c74e725cc1c2d94c555
6
+ metadata.gz: d32a946890cc15941752ee4aa375e04a9da9b51661b55e0f674805c99546cfdd21625c34b10a3a24562829d5843f039664faf6f6bd3709b6d475a4b1db3a698c
7
+ data.tar.gz: 9554e5d8f4aa8dd217eb40f36cb4e7468b61dab9048312bd25b346cd5866158e86316fa08e0509eb7ba536f1d81d1447d55c65debba27e9312535982b7b4459a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- fx = OpenExchangeRates::Rates.new(:app_id => @app_id)
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.3.1
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
- MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMTA2MTMzMTA1WhcN
15
- MTkwMTA2MTMzMTA1WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggEiMA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HhXgBx7q1LmoKfLINFZEYzYNgNqL0xzv5nlP
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: 2018-06-08 00:00:00.000000000 Z
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: james@jamesrobertson.eu
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.6.13
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