Class: Intermix::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/intermix/configuration.rb

Constant Summary collapse

CLUSTER_TYPE =
'RedshiftCluster'
API_URL =
'https://dashboard.intermix.io/api'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token:, cluster_id:) ⇒ Configuration

Returns a new instance of Configuration.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
# File 'lib/intermix/configuration.rb', line 8

def initialize(api_token:, cluster_id:)
  raise ArgumentError, 'api_token cannot be nil.' unless api_token.present?
  raise ArgumentError, 'cluster_id cannot be nil.' unless cluster_id.present?

  @api_token  = api_token
  @cluster_id = cluster_id

  @cluster_type = CLUSTER_TYPE
  @api_url      = API_URL
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



6
7
8
# File 'lib/intermix/configuration.rb', line 6

def api_token
  @api_token
end

#api_urlObject (readonly)

Returns the value of attribute api_url.



6
7
8
# File 'lib/intermix/configuration.rb', line 6

def api_url
  @api_url
end

#cluster_idObject (readonly)

Returns the value of attribute cluster_id.



6
7
8
# File 'lib/intermix/configuration.rb', line 6

def cluster_id
  @cluster_id
end

#cluster_typeObject (readonly)

Returns the value of attribute cluster_type.



6
7
8
# File 'lib/intermix/configuration.rb', line 6

def cluster_type
  @cluster_type
end

Instance Method Details

#base_uriObject



19
20
21
# File 'lib/intermix/configuration.rb', line 19

def base_uri
  @base_uri = "#{@api_url}/#{@cluster_type}/#{@cluster_id}" unless defined?(@base_uri)
end