Module: CassClient::Connection

Included in:
Base
Defined in:
lib/cass_fmadata_client/connection.rb

Overview

Connection module

Constant Summary collapse

DEFAULT_URL =
'www.example.com'.freeze
DEFAULT_VERSION =
'/api'.freeze
DEFAULT_MAX_RETRIES =

retry logic defaults:

5
DEFAULT_RETRY_INTERVAL =

retry interval in seconds

3

Instance Method Summary collapse

Instance Method Details

#base_urlObject



27
28
29
# File 'lib/cass_fmadata_client/connection.rb', line 27

def base_url
  URI.parse(@host).to_s
end

#headersObject



21
22
23
24
25
# File 'lib/cass_fmadata_client/connection.rb', line 21

def headers
  {
    'Token': @token
  }
end

#setup_connection(p = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/cass_fmadata_client/connection.rb', line 14

def setup_connection(p = {})
  @host           = p[:host]            || DEFAULT_URL
  @token          = p[:token]
  @max_retries    = p[:max_retries]     || DEFAULT_MAX_RETRIES
  @retry_interval = p[:retry_interval]  || DEFAULT_RETRY_INTERVAL
end