Doing the maintenance dance
This commit is contained in:
parent
9ebb9f0c9b
commit
2033546272
@ -1,7 +1,16 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2015-10-04 18:16:18 -0400 using RuboCop version 0.34.2.
|
# on 2016-08-30 10:56:44 -0400 using RuboCop version 0.42.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Max: 17
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Configuration parameters: CountComments.
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Max: 14
|
||||||
|
2
Gemfile
2
Gemfile
@ -1,6 +1,6 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '2.2.3' if ENV.key?('DYNO')
|
ruby '2.3.1' if ENV.key?('DYNO')
|
||||||
|
|
||||||
gem 'aws-sdk', '~> 2'
|
gem 'aws-sdk', '~> 2'
|
||||||
gem 'pry', group: %i(development test)
|
gem 'pry', group: %i(development test)
|
||||||
|
43
Gemfile.lock
43
Gemfile.lock
@ -1,37 +1,34 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ast (2.1.0)
|
ast (2.3.0)
|
||||||
astrolabe (1.3.1)
|
aws-sdk (2.5.6)
|
||||||
parser (~> 2.2)
|
aws-sdk-resources (= 2.5.6)
|
||||||
aws-sdk (2.1.20)
|
aws-sdk-core (2.5.6)
|
||||||
aws-sdk-resources (= 2.1.20)
|
|
||||||
aws-sdk-core (2.1.20)
|
|
||||||
jmespath (~> 1.0)
|
jmespath (~> 1.0)
|
||||||
aws-sdk-resources (2.1.20)
|
aws-sdk-resources (2.5.6)
|
||||||
aws-sdk-core (= 2.1.20)
|
aws-sdk-core (= 2.5.6)
|
||||||
coderay (1.1.0)
|
coderay (1.1.1)
|
||||||
jmespath (1.0.2)
|
jmespath (1.3.1)
|
||||||
multi_json (~> 1.0)
|
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
multi_json (1.11.2)
|
parser (2.3.1.2)
|
||||||
parser (2.2.2.6)
|
ast (~> 2.2)
|
||||||
ast (>= 1.1, < 3.0)
|
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
pry (0.10.1)
|
pry (0.10.4)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
rack (1.6.4)
|
rack (2.0.1)
|
||||||
rainbow (2.0.0)
|
rainbow (2.1.0)
|
||||||
rubocop (0.34.2)
|
rubocop (0.42.0)
|
||||||
astrolabe (~> 1.3)
|
parser (>= 2.3.1.1, < 3.0)
|
||||||
parser (>= 2.2.2.5, < 3.0)
|
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
rainbow (>= 1.99.1, < 3.0)
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.7)
|
||||||
ruby-progressbar (1.7.5)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
|
ruby-progressbar (1.8.1)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
|
unicode-display_width (1.1.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@ -43,4 +40,4 @@ DEPENDENCIES
|
|||||||
rubocop
|
rubocop
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.10.6
|
1.12.5
|
||||||
|
@ -5,7 +5,7 @@ require 'net/http'
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
class CPIFetcher
|
class CPIFetcher
|
||||||
DEFAULT_CPI_SERIES_URL = 'http://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0'
|
DEFAULT_CPI_SERIES_URL = 'http://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0'.freeze
|
||||||
attr_reader :cpi_series_url
|
attr_reader :cpi_series_url
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@ -17,7 +17,9 @@ class CPIFetcher
|
|||||||
|
|
||||||
return nil unless resp['Results']['series']
|
return nil unless resp['Results']['series']
|
||||||
|
|
||||||
resp['Results']['series'].first['data'].first['value']
|
data = resp['Results']['series'].first['data']
|
||||||
|
data.sort! { |a, b| a['year'] <=> b['year'] }
|
||||||
|
data.last['value']
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -31,64 +33,3 @@ if $PROGRAM_NAME == __FILE__
|
|||||||
puts CPIFetcher.new.cpi
|
puts CPIFetcher.new.cpi
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
__END__
|
|
||||||
{
|
|
||||||
"status": "REQUEST_SUCCEEDED",
|
|
||||||
"responseTime": 36,
|
|
||||||
"message": [],
|
|
||||||
"Results": {
|
|
||||||
"series": [
|
|
||||||
{
|
|
||||||
"seriesID": "CUUSA210SA0",
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"year": "2015",
|
|
||||||
"period": "S01",
|
|
||||||
"periodName": "1st Half",
|
|
||||||
"value": "220.381",
|
|
||||||
"footnotes": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"year": "2014",
|
|
||||||
"period": "S02",
|
|
||||||
"periodName": "2nd Half",
|
|
||||||
"value": "220.891",
|
|
||||||
"footnotes": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"year": "2014",
|
|
||||||
"period": "S01",
|
|
||||||
"periodName": "1st Half",
|
|
||||||
"value": "220.352",
|
|
||||||
"footnotes": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"year": "2013",
|
|
||||||
"period": "S02",
|
|
||||||
"periodName": "2nd Half",
|
|
||||||
"value": "217.983",
|
|
||||||
"footnotes": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"year": "2013",
|
|
||||||
"period": "S01",
|
|
||||||
"periodName": "1st Half",
|
|
||||||
"value": "216.941",
|
|
||||||
"footnotes": [
|
|
||||||
{}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user