Update to bls tls
This commit is contained in:
parent
28841035af
commit
3a56880720
@ -1,14 +1,14 @@
|
||||
# cpi-feed
|
||||
|
||||
Transforms [this](http://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0)
|
||||
into [this](http://s3.amazonaws.com/meatballhat/cpi/current.csv) :tada:.
|
||||
Transforms [this](https://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0)
|
||||
into [this](https://s3.amazonaws.com/meatballhat/cpi/current.csv) :tada:.
|
||||
|
||||
## usage
|
||||
|
||||
This is intended for use with Google Sheets via:
|
||||
|
||||
```
|
||||
=IMPORTDATA("http://s3.amazonaws.com/meatballhat/cpi/current.csv")
|
||||
=IMPORTDATA("https://s3.amazonaws.com/meatballhat/cpi/current.csv")
|
||||
```
|
||||
|
||||
## deployment
|
||||
|
@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'uri'
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
require 'net/https'
|
||||
require 'uri'
|
||||
|
||||
class CPIFetcher
|
||||
DEFAULT_CPI_SERIES_URL = 'http://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0'.freeze
|
||||
DEFAULT_CPI_SERIES_URL = 'https://api.bls.gov/publicAPI/v2/timeseries/data/CUUSA210SA0'.freeze
|
||||
attr_reader :url, :bls_token
|
||||
|
||||
def initialize
|
||||
@ -26,9 +27,10 @@ class CPIFetcher
|
||||
private
|
||||
|
||||
def fetch_raw_response
|
||||
res = Net::HTTP.start(url.hostname, url.port) do |http|
|
||||
http.request(build_request)
|
||||
end
|
||||
http = Net::HTTP.new(url.hostname, url.port)
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
res = http.request(build_request)
|
||||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user