Skip to content

Instantly share code, notes, and snippets.

@agungsetiawan
Last active March 31, 2020 05:41
Show Gist options
  • Save agungsetiawan/0c821c2a00e1f1615fd12323b5a06e70 to your computer and use it in GitHub Desktop.
Save agungsetiawan/0c821c2a00e1f1615fd12323b5a06e70 to your computer and use it in GitHub Desktop.
class Connection
def self.internal_api(*args)
self.faraday(*args) do |f|
f.headers['Content-Type'] = 'application/json'
f.headers['InternalAPIPassword'] = ENV['INTERNAL_API_PASSWORD']
f.headers['UserRole'] = ENV['USER_ROLE']
f.headers['UserCode'] = ENV['USER_CODE']
end
end
def self.faraday(*args)
Faraday.new(*args) do |f|
yield(f) if block_given?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment