Class: PCO::URL::ChurchCenter

Inherits:
PCO::URL
  • Object
show all
Defined in:
lib/pco/url/church_center.rb

Constant Summary

Constants inherited from PCO::URL

DOMAINS, VERSION

Instance Attribute Summary

Attributes inherited from PCO::URL

#app_name, #path, #query

Instance Method Summary collapse

Methods inherited from PCO::URL

decrypt_query_params, method_missing, parse, #scheme, #to_s, #uri

Constructor Details

#initialize(app_name: "church-center", path: nil, query: nil, encrypt_query_params: false, domain: nil, subdomain: nil) ⇒ ChurchCenter

Returns a new instance of ChurchCenter.



4
5
6
7
8
9
10
11
12
13
# File 'lib/pco/url/church_center.rb', line 4

def initialize(app_name: "church-center", path: nil, query: nil, encrypt_query_params: false, domain: nil, subdomain: nil)
  super(
    app_name: app_name,
    path: path,
    query: query,
    encrypt_query_params: encrypt_query_params,
    domain: domain
  )
  @subdomain = subdomain
end

Instance Method Details

#domainObject



15
16
17
18
19
20
21
22
23
# File 'lib/pco/url/church_center.rb', line 15

def domain
  return @domain if @domain
  case env
  when "production", "staging"
    "churchcenter.com"
  when "development", "test"
    "churchcenter.test"
  end
end

#hostnameObject



25
26
27
28
29
30
31
32
33
# File 'lib/pco/url/church_center.rb', line 25

def hostname
  super if env_overridden_hostname
  sub = "#{@subdomain}." if @subdomain
  if env == "staging"
    "#{sub}staging.#{domain}"
  else
    "#{sub}#{domain}"
  end
end