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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41009cf622b4fb1042aa0db0dae7a2dd9b963c65
4
- data.tar.gz: 613dbe94db7fb1dfe6931a2a190bd0f5a0b6052a
3
+ metadata.gz: b2cbf32f8bd4fd153daefb850c754fc61826abfc
4
+ data.tar.gz: 23727161bc9bb93a99eb9848966ec7f7f392f06b
5
5
  SHA512:
6
- metadata.gz: 2527f8c435f7c7a8904b9daa8190ea243ba462d63a4ab3153dd22341752ce37f6e7307eaf9487d269ec28602d914a53190a2093b976fdfa2eaa1446698d1d356
7
- data.tar.gz: a215f1692f1f18ce3f4120befc50ccfd345c48ab64ad08e41d8b03d8e1f86dcc59a6555e4045303341771063d6d3c7e5ef58e524184ff2cdb6f68fa4ec6f7360
6
+ metadata.gz: f07448151349cdc26fb30d6f5d968c0cc37cb29417d10f89d8d282e8819515a929e4cfa4178ca05656dc440ef3d41a75d754bf4dbc9dd6132caed9b6efec4450
7
+ data.tar.gz: b6f1f93a7d37d51a5e465bfd7a4d4059d0fe6834ffcfa8fe4fe5e78dcf657c03da08a4ad85a226effb27ddf1b8926aff5a3776668980b84d7ba3093d5816d2f2
@@ -2,3 +2,6 @@ Style/Documentation:
2
2
  Enabled: false
3
3
 
4
4
  require: rubocop-rspec
5
+
6
+ RSpec/NestedGroups:
7
+ MaxNesting: 3
@@ -1,3 +1,7 @@
1
+ # 0.1.3 / 2017-01-02
2
+
3
+ * Fix edge case when table for last year isn't published yet
4
+
1
5
  # 0.1.2 / 2016-10-01
2
6
 
3
7
  * Add verbose mode
@@ -43,8 +43,18 @@ module ExchangeRatesNBP
43
43
  end
44
44
 
45
45
  def all_table_ids
46
- body = HTTP.get(BASE_URL + table_list_url, encoding: 'utf-8').to_s
47
- body.scan(PATTERN)
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
@@ -1,3 +1,3 @@
1
1
  module ExchangeRatesNBP
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  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.2
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: 2016-10-01 00:00:00.000000000 Z
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.6.4
241
+ rubygems_version: 2.5.1
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Collects exchange rates from nbp.pl