exchange_rates_api 0.1.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/exchange_rates_api.rb +1 -0
- data/lib/exchange_rates_api/client.rb +21 -0
- data/lib/exchange_rates_api/client/latest.rb +17 -0
- data/lib/exchange_rates_api/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a8d39cf9c62df697afafa03b8171ea46288d2fb0a45be3d5c632289b6c5e2d
|
4
|
+
data.tar.gz: 998a70fcef120ab27d7268c732d6a004b22b1b49b8b41115624bbfa9553665ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c3e965aa0bc2ae2840b1603c35d9065fd5c2de1eb592f65b015c17fcf19aa5e30f0706741319cb693dceb6e2b546a2bc8fa06e93b45a41ea8da869b3e39db3
|
7
|
+
data.tar.gz: 3827d2396f2544d5c4053a12f282427c0c4d6ca4d37d21b0a53e5a944a0ac553cb3c091b0c7650b2cdd0fd67133ebc88c948526f4497edc091c408f73a1f782f
|
data/lib/exchange_rates_api.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative 'client/latest'
|
3
|
+
|
4
|
+
module ExchangeRatesApi
|
5
|
+
# Client requests
|
6
|
+
class Client
|
7
|
+
include HTTParty
|
8
|
+
include ExchangeRatesApi::Client::Latest
|
9
|
+
|
10
|
+
def initialize; end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def provider(name)
|
15
|
+
case name
|
16
|
+
when 'fixer' then 'https://data.fixer.io/api'
|
17
|
+
else 'https://api.exchangeratesapi.io'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ExchangeRatesApi
|
2
|
+
class Client
|
3
|
+
# methods for request
|
4
|
+
module Latest
|
5
|
+
def latest(args = {})
|
6
|
+
body = { base: base(args[:base]) }
|
7
|
+
self.class.get("#{provider(args[:provider])}/latest", query: body).parsed_response
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def base(value)
|
13
|
+
value || 'EUR'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exchange_rates_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JungleCoders
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-04-
|
12
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -117,6 +117,8 @@ files:
|
|
117
117
|
- bin/setup
|
118
118
|
- exchange_rates_api.gemspec
|
119
119
|
- lib/exchange_rates_api.rb
|
120
|
+
- lib/exchange_rates_api/client.rb
|
121
|
+
- lib/exchange_rates_api/client/latest.rb
|
120
122
|
- lib/exchange_rates_api/version.rb
|
121
123
|
homepage: https://github.com/WebGents/exchange_rates_api
|
122
124
|
licenses:
|