exchange_rates_nbp 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/lib/exchange_rates_nbp/clients/table_list.rb +16 -2
- data/lib/exchange_rates_nbp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2cbf32f8bd4fd153daefb850c754fc61826abfc
|
4
|
+
data.tar.gz: 23727161bc9bb93a99eb9848966ec7f7f392f06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f07448151349cdc26fb30d6f5d968c0cc37cb29417d10f89d8d282e8819515a929e4cfa4178ca05656dc440ef3d41a75d754bf4dbc9dd6132caed9b6efec4450
|
7
|
+
data.tar.gz: b6f1f93a7d37d51a5e465bfd7a4d4059d0fe6834ffcfa8fe4fe5e78dcf657c03da08a4ad85a226effb27ddf1b8926aff5a3776668980b84d7ba3093d5816d2f2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -43,8 +43,18 @@ module ExchangeRatesNBP
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def all_table_ids
|
46
|
-
|
47
|
-
|
46
|
+
if @year == Date.today.year
|
47
|
+
response = request_table(FILE_NAME_CURRENT_YEAR)
|
48
|
+
else
|
49
|
+
response = request_table(FILE_NAME_YEAR_PATTERN.sub('{year}',
|
50
|
+
@year.to_s))
|
51
|
+
|
52
|
+
if response.status == 404
|
53
|
+
response = request_table(FILE_NAME_CURRENT_YEAR)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
response.to_s.scan(PATTERN)
|
48
58
|
end
|
49
59
|
|
50
60
|
def table_list_url
|
@@ -54,6 +64,10 @@ module ExchangeRatesNBP
|
|
54
64
|
FILE_NAME_YEAR_PATTERN.sub('{year}', @year.to_s)
|
55
65
|
end
|
56
66
|
end
|
67
|
+
|
68
|
+
def request_table(suffix)
|
69
|
+
HTTP.get(BASE_URL + suffix, encoding: 'utf-8')
|
70
|
+
end
|
57
71
|
end
|
58
72
|
end
|
59
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exchange_rates_nbp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Majewski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.5.1
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Collects exchange rates from nbp.pl
|