Class: Driftrock::Service::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/driftrock-service/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token

Returns:

  • (Object)

    the current value of api_token



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def api_token
  @api_token
end

#app_idObject

Returns the value of attribute app_id

Returns:

  • (Object)

    the current value of app_id



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def app_id
  @app_id
end

#environmentObject

Returns the value of attribute environment

Returns:

  • (Object)

    the current value of environment



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def environment
  @environment
end

#log_levelObject

Returns the value of attribute log_level

Returns:

  • (Object)

    the current value of log_level



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def log_level
  @log_level
end

#log_locationObject

Returns the value of attribute log_location

Returns:

  • (Object)

    the current value of log_location



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def log_location
  @log_location
end

#logout_actionObject

Returns the value of attribute logout_action

Returns:

  • (Object)

    the current value of logout_action



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def logout_action
  @logout_action
end

#saltObject

Returns the value of attribute salt

Returns:

  • (Object)

    the current value of salt



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def salt
  @salt
end

#status_actionObject

Returns the value of attribute status_action

Returns:

  • (Object)

    the current value of status_action



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def status_action
  @status_action
end

#status_locationObject

Returns the value of attribute status_location

Returns:

  • (Object)

    the current value of status_location



3
4
5
# File 'lib/driftrock-service/config.rb', line 3

def status_location
  @status_location
end

Class Method Details

.api_locationObject



9
10
11
12
13
14
15
# File 'lib/driftrock-service/config.rb', line 9

def self.api_location
  if config_properties.environment == :production
    "https://driftrock-api.herokuapp.com"
  else
    "http://localhost:9393"
  end
end

.api_tokenObject



21
22
23
# File 'lib/driftrock-service/config.rb', line 21

def self.api_token
  config_properties.api_token
end

.app_idObject



25
26
27
# File 'lib/driftrock-service/config.rb', line 25

def self.app_id
  config_properties.app_id
end

.environmentObject



45
46
47
# File 'lib/driftrock-service/config.rb', line 45

def self.environment
  config_properties.enviroment
end

.init {|config_properties| ... } ⇒ Object

Yields:

  • (config_properties)


49
50
51
52
53
54
55
56
57
58
59
# File 'lib/driftrock-service/config.rb', line 49

def self.init
  yield(config_properties)
  if defined?(Rails) && config_properties.app_id 
    status_action = config_properties.status_action
    logout_action = config_properties.logout_action
    Rails.application.routes.prepend do
      get 'driftrock_app_status' => status_action 
      get 'driftrock_logout' => logout_action
    end
  end
end

.log_levelObject



29
30
31
# File 'lib/driftrock-service/config.rb', line 29

def self.log_level
  config_properties.log_level
end

.log_locationObject



33
34
35
# File 'lib/driftrock-service/config.rb', line 33

def self.log_location
  config_properties.log_location
end

.saltObject



17
18
19
# File 'lib/driftrock-service/config.rb', line 17

def self.salt
  config_properties.salt
end

.website_locationObject



37
38
39
40
41
42
43
# File 'lib/driftrock-service/config.rb', line 37

def self.website_location
  if config_properties.environment == :production
    "http://www.driftrock.com"
  else
    "http://localhost:3000"
  end
end