Class: Strapi::Connection
- Inherits:
-
Object
- Object
- Strapi::Connection
- Defined in:
- lib/strapi/connection.rb
Overview
The singleton class representing the Faraday connection to Strapi
Class Method Summary collapse
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/strapi/connection.rb', line 7 def instance @instance ||= Faraday::Connection.new("#{ENV['STRAPI_HOST_URL']}/api", ) end |
.options ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/strapi/connection.rb', line 11 def return unless (api_token = ENV['STRAPI_API_TOKEN'].presence) { headers: { 'Authorization' => "bearer #{api_token}" } } end |