Class: Conexa::Configuration

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

Constant Summary collapse

TRUTHY =

Values that turn read-only mode on via CONEXA_READ_ONLY.

%w[1 true yes on].freeze
FALSEY =

Values that explicitly turn it off. Anything else is a typo worth warning about — silently failing open on CONEXA_READ_ONLY=treu would leave an operator believing writes were blocked when they are not.

%w[0 false no off].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



24
25
26
27
28
# File 'lib/conexa/configuration.rb', line 24

def initialize
  @api_token = ''
  @api_host = ''
  @read_only = nil
end

Instance Attribute Details

#api_hostString

Returns the tenant base URL, e.g. "https://mycompany.conexa.app".

Returns:



10
11
12
# File 'lib/conexa/configuration.rb', line 10

def api_host
  @api_host
end

#api_tokenString

Returns the Application Token, created in Conexa under Config > Integrações > API / Token.

Returns:

  • (String)

    the Application Token, created in Conexa under Config > Integrações > API / Token



7
8
9
# File 'lib/conexa/configuration.rb', line 7

def api_token
  @api_token
end

#read_onlyBoolean

When true, any request other than GET raises ReadOnlyError before reaching the network.

Read lazily so that CONEXA_READ_ONLY still applies when it is set after Conexa.configure has run — it used to be captured once at initialization, which made setting it later a silent no-op. An explicit assignment always wins over the environment.

Returns:

  • (Boolean)


39
40
41
42
43
# File 'lib/conexa/configuration.rb', line 39

def read_only
  return @read_only unless @read_only.nil?

  env_read_only
end