Module: DeckAPI::Client

Defined in:
lib/deck-api/client.rb

Constant Summary collapse

API_ENDPOINT =
'index.php/apps/deck/api/v1.0'
HEADERS =
{ 'Content-Type' => 'application/json',
'OCS-APIRequest' => 'true' }.freeze

Class Method Summary collapse

Class Method Details

.connection(domain, username, password, stubs = nil) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/deck-api/client.rb', line 11

def self.connection(domain, username, password, stubs = nil)
  url_base = "https://#{domain}/#{API_ENDPOINT}"

  Faraday.new(url: url_base, headers: HEADERS) do |builder|
    builder.use Faraday::Request::BasicAuthentication, username, password
    builder.adapter(:test, stubs) if ENV['APPLICATION_MODE'] == 'test'
  end
end