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