Class: JobTick::Configuration

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

Constant Summary collapse

DEFAULT_QUEUE_LIMIT =
1000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
# File 'lib/jobtick/configuration.rb', line 10

def initialize
  @endpoint     = "https://api.jobtick.app/v1"
  @environment  = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "production"
  @enabled      = @environment == "production"
  @prune        = false
  @queue_limit  = DEFAULT_QUEUE_LIMIT
  @sync_on_boot = true
  @ping_started = true
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#enabledObject

Returns the value of attribute enabled.



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

def enabled
  @enabled
end

#endpointObject

Returns the value of attribute endpoint.



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

def endpoint
  @endpoint
end

#environmentObject

Returns the value of attribute environment.



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

def environment
  @environment
end

#ping_startedObject

Returns the value of attribute ping_started.



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

def ping_started
  @ping_started
end

#pruneObject

Returns the value of attribute prune.



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

def prune
  @prune
end

#queue_limitObject

Returns the value of attribute queue_limit.



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

def queue_limit
  @queue_limit
end

#sync_on_bootObject

Returns the value of attribute sync_on_boot.



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

def sync_on_boot
  @sync_on_boot
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/jobtick/configuration.rb', line 20

def enabled?
  @enabled && !@api_key.nil?
end