Module: Legion::Extensions::Rfp::Review::Helpers::Client

Included in:
Client, Runners::Approvals, Runners::Comments, Runners::Workflows
Defined in:
lib/legion/extensions/rfp/review/helpers/client.rb

Instance Method Summary collapse

Instance Method Details

#client(base_url: 'http://localhost:4567', token: nil) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/legion/extensions/rfp/review/helpers/client.rb', line 11

def client(base_url: 'http://localhost:4567', token: nil, **)
  Faraday.new(url: base_url) do |conn|
    conn.request :json
    conn.response :json, content_type: /\bjson$/
    conn.headers['Content-Type'] = 'application/json'
    conn.headers['Authorization'] = "Bearer #{token}" if token
  end
end