Class: WCC::Auth::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/wcc/auth/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_domain_suffixObject

Returns the value of attribute app_domain_suffix

Returns:

  • (Object)

    the current value of app_domain_suffix



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_domain_suffix
  @app_domain_suffix
end

#app_idObject

Returns the value of attribute app_id

Returns:

  • (Object)

    the current value of app_id



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_id
  @app_id
end

#app_nameObject

Returns the value of attribute app_name

Returns:

  • (Object)

    the current value of app_name



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_name
  @app_name
end

#app_secretObject

Returns the value of attribute app_secret

Returns:

  • (Object)

    the current value of app_secret



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_secret
  @app_secret
end

#app_urlObject

Returns the value of attribute app_url

Returns:

  • (Object)

    the current value of app_url



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_url
  @app_url
end

#app_url_protocolObject

Returns the value of attribute app_url_protocol

Returns:

  • (Object)

    the current value of app_url_protocol



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def app_url_protocol
  @app_url_protocol
end

#authorize_paramsObject

Returns the value of attribute authorize_params

Returns:

  • (Object)

    the current value of authorize_params



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def authorize_params
  @authorize_params
end

#authorize_pathObject

Returns the value of attribute authorize_path

Returns:

  • (Object)

    the current value of authorize_path



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def authorize_path
  @authorize_path
end

#authorize_siteObject

Returns the value of attribute authorize_site

Returns:

  • (Object)

    the current value of authorize_site



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def authorize_site
  @authorize_site
end

#environmentObject

Returns the value of attribute environment

Returns:

  • (Object)

    the current value of environment



1
2
3
# File 'lib/wcc/auth/config.rb', line 1

def environment
  @environment
end

Instance Method Details

#app_domain_suffix_for(environment) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/wcc/auth/config.rb', line 55

def app_domain_suffix_for(environment)
  case environment.to_sym
  when :production
    ".watermark.org"
  when :staging
    ".staging.watermark.org"
  when :development
    ".dev"
  end
end

#app_url_protocol_for(environment) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/wcc/auth/config.rb', line 66

def app_url_protocol_for(environment)
  case environment.to_sym
  when :production
    "https"
  else
    "http"
  end
end

#nucleus_urlObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/wcc/auth/config.rb', line 42

def nucleus_url
  return ENV['NUCLEUS_URL'] if ENV['NUCLEUS_URL']

  case environment.to_sym
  when :production
    "https://login.watermark.org"
  when :staging
    "http://login.staging.watermark.org"
  when :development
    "http://login.dev"
  end
end

#url_for(app_name) ⇒ Object



36
37
38
39
40
# File 'lib/wcc/auth/config.rb', line 36

def url_for(app_name)
  return ENV["#{app_name.to_s.upcase}_URL"] if ENV["#{app_name.to_s.upcase}_URL"]

  "#{app_url_protocol_for(environment)}://#{app_name}#{app_domain_suffix_for(environment)}"
end