Skip to content

Instantly share code, notes, and snippets.

@anasbgoncalves
Last active May 20, 2020 17:17
Show Gist options
  • Save anasbgoncalves/133063ec994238f7a8fc6e0eddfd667f to your computer and use it in GitHub Desktop.
Save anasbgoncalves/133063ec994238f7a8fc6e0eddfd667f to your computer and use it in GitHub Desktop.
require 'faraday'
require 'json'
class Connection
BASE = 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com'
def self.api
Faraday.new(url: BASE) do |faraday|
faraday.response :logger
faraday.adapter Faraday.default_adapter
faraday.headers['Content-Type'] = 'application/json'
faraday.headers['X-Mashape-Key'] = ENV['MASHAPE_KEY']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment