Skip to content

Instantly share code, notes, and snippets.

@rakibulislam
Created July 26, 2016 15:31
Show Gist options
  • Save rakibulislam/de37fd150ac98fe88ac157d52fd6e56b to your computer and use it in GitHub Desktop.
Save rakibulislam/de37fd150ac98fe88ac157d52fd6e56b to your computer and use it in GitHub Desktop.
# https://github.com/plataformatec/faraday-http-cache
client = Faraday.new do |builder|
builder.use :http_cache, store: Rails.cache, logger: Rails.logger
builder.adapter Faraday.default_adapter
end
response = client.get("#{Settings[:api_server]}/#{resource}",
{ start_date_key => range_parameter },
{ 'Accept' => 'application/json' }
)
JSON.parse(response.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment