fixer 0.7.0 → 1.0.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
- SHA1:
3
- metadata.gz: 7e2bb1a849196885e960275051e7c288cdc8938f
4
- data.tar.gz: 8bb28233ecc930c2db850fea7697f16bd098ae6f
2
+ SHA256:
3
+ metadata.gz: 00e93800502c8961417bae0a5b208a2632e4796f9920968378afb23a0a5ce843
4
+ data.tar.gz: 60ce9859451e706d7043763bf13b39e0cdf1478c4d6ada914884b9536af23534
5
5
  SHA512:
6
- metadata.gz: 8cc831d269e23eab91fa468fbe20b9744ca857ec9ec18e719dcf1cf301f109660ec30ecea05d9785a7f30367e2de9fd1c8a90671fb73f29aad03b248c0cdaa82
7
- data.tar.gz: 0e5d2067e9bce1d82ce81e40c297307b2128e8a42f6425f8709a02d95868b552aa9d6ef1b45c256fc2404273eb32709f137dcfaf0cfed6b8b4606e53d8bf4886
6
+ metadata.gz: 1471bf6f64cdd03e76e586da142fe47189b404ca65278105a155dcd45d3730f3774949dfd2ec2a7693aa2da989c11d7963bba0e75840cda7d355a8742836e455
7
+ data.tar.gz: 16388fe1a945cefb31ba475f3819bb40c2c09f6797bf9c7bbb7aad7b17762a2b6587d9beadac87a0e01a45aa6fbb7bab1aadf3ca8d8f864f19cd55665d853b2f
data/README.md CHANGED
@@ -1,12 +1,9 @@
1
1
  # Fixer
2
2
 
3
- [![Travis](https://travis-ci.org/hakanensari/fixer.svg)](https://travis-ci.org/hakanensari/fixer)
4
-
5
- Fixer is a Ruby wrapper to the [XML feeds of Euro foreign exchange reference rates](http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html) provided by the European Central Bank. The reference rates are updated around 15:00 CET on working days.
3
+ Fixer wraps the XML feeds of Euro foreign exchange reference provided by the European Central Bank:
6
4
 
7
5
  ```ruby
8
- feed = Fixer::Feed.new
9
- feed.each do |currency|
10
- # puts currency
11
- end
6
+ Fixer.current
7
+ Fixer.ninety_days
8
+ Fixer.historical
12
9
  ```
@@ -1 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fixer/feed'
4
+
5
+ # ECB exchange rate datasets
6
+ #
7
+ # The three available short hands here are `.current`, `.ninety_days`, and
8
+ # `.historical`.
9
+ module Fixer
10
+ class << self
11
+ Feed::SCOPES.each_key do |scope|
12
+ define_method(scope) do
13
+ Feed.new(scope)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,18 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'net/http'
2
4
  require 'rexml/document'
3
5
 
4
6
  module Fixer
7
+ # Wraps ECB's data feed
5
8
  class Feed
6
9
  include Enumerable
7
10
 
8
- TYPES = {
11
+ SCOPES = {
9
12
  current: 'daily',
10
13
  ninety_days: 'hist-90d',
11
14
  historical: 'hist'
12
15
  }.freeze
13
16
 
14
- def initialize(type = :current)
15
- @type = TYPES.fetch(type) { raise ArgumentError }
17
+ def initialize(scope = :current)
18
+ @scope = SCOPES.fetch(scope) { raise ArgumentError }
16
19
  end
17
20
 
18
21
  def each
@@ -39,7 +42,7 @@ module Fixer
39
42
  end
40
43
 
41
44
  def url
42
- URI("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-#{@type}.xml")
45
+ URI("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-#{@scope}.xml")
43
46
  end
44
47
  end
45
48
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fixer
2
- VERSION = '0.7.0'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2017-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '5.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '5.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,30 +70,30 @@ dependencies:
70
70
  name: vcr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.24'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.24'
96
+ version: '0'
97
97
  description:
98
98
  email:
99
99
  - hakanensari@gmail.com
@@ -101,7 +101,6 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - LICENSE
105
104
  - README.md
106
105
  - lib/fixer.rb
107
106
  - lib/fixer/feed.rb
@@ -126,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
125
  version: '0'
127
126
  requirements: []
128
127
  rubyforge_project:
129
- rubygems_version: 2.5.1
128
+ rubygems_version: 2.7.3
130
129
  signing_key:
131
130
  specification_version: 4
132
131
  summary: A wrapper to the exchange rate feeds of the European Central Bank
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) Hakan Ensari
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.