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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ccdccaab68bc64faef1df5d70bf1410bedd4911cbffbefed607ac3b10c18754
4
- data.tar.gz: ea4e3290d51f4308e279c105d57082854dc0a552e17c9cb278b3a01515eaf376
3
+ metadata.gz: e3a8d39cf9c62df697afafa03b8171ea46288d2fb0a45be3d5c632289b6c5e2d
4
+ data.tar.gz: 998a70fcef120ab27d7268c732d6a004b22b1b49b8b41115624bbfa9553665ae
5
5
  SHA512:
6
- metadata.gz: b97d2189c8f8cfc82f04eda133767bcad62f120b7846f0845e847231aeb9b749f839b2a52c0021e4193d415136f48ff71f18a56833ab449e6f9df70a1d7596eb
7
- data.tar.gz: 35ca5bc838859e2bdcf79cb4d7992cb6159f8cda95cc8d0b9e91b182089caa711595429a0f6fd7ad371adf8a259221ad5e7f215229c305bdb02c7ef27763608f
6
+ metadata.gz: 05c3e965aa0bc2ae2840b1603c35d9065fd5c2de1eb592f65b015c17fcf19aa5e30f0706741319cb693dceb6e2b546a2bc8fa06e93b45a41ea8da869b3e39db3
7
+ data.tar.gz: 3827d2396f2544d5c4053a12f282427c0c4d6ca4d37d21b0a53e5a944a0ac553cb3c091b0c7650b2cdd0fd67133ebc88c948526f4497edc091c408f73a1f782f
@@ -1,5 +1,6 @@
1
1
  require 'dotenv/load'
2
2
  require_relative 'exchange_rates_api/version'
3
+ require_relative 'exchange_rates_api/client'
3
4
 
4
5
  # Base module
5
6
  module ExchangeRatesApi
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ExchangeRatesApi
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  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.1.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-01 00:00:00.000000000 Z
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: