Class: Landable::Configuration

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

Defined Under Namespace

Classes: CORS, Screenshots

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_hostObject



33
34
35
# File 'lib/landable/configuration.rb', line 33

def api_host
  @api_host ||= api_uri.try(:host)
end

#api_namespaceObject



37
38
39
# File 'lib/landable/configuration.rb', line 37

def api_namespace
  @api_namespace ||= (api_uri.try(:path).presence || '/api/landable')
end

#api_urlObject

Returns the value of attribute api_url.



3
4
5
# File 'lib/landable/configuration.rb', line 3

def api_url
  @api_url
end

#categoriesObject



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/landable/configuration.rb', line 63

def categories
  # default categories
  @categories ||= {
    'Affiliates' => '',
    'PPC' => 'Pay-per-click',
    'SEO' => 'Search engine optimization',
    'Social' => '',
    'Email' => '',
    'Traditional' => '',
  }
end

#database_schema_prefixObject



55
56
57
# File 'lib/landable/configuration.rb', line 55

def database_schema_prefix
  @database_schema_prefix ||= ''
end

#partials_to_templatesObject



75
76
77
# File 'lib/landable/configuration.rb', line 75

def partials_to_templates
  @partials_to_templates ||= []
end

#public_hostObject



47
48
49
# File 'lib/landable/configuration.rb', line 47

def public_host
  @public_host ||= public_uri.try(:host)
end

#public_namespaceObject



51
52
53
# File 'lib/landable/configuration.rb', line 51

def public_namespace
  @public_namespace ||= (public_uri.try(:path).presence || '')
end

#public_urlObject

Returns the value of attribute public_url.



3
4
5
# File 'lib/landable/configuration.rb', line 3

def public_url
  @public_url
end

#publicist_urlObject



23
24
25
# File 'lib/landable/configuration.rb', line 23

def publicist_url
  @publicist_url ||= 'publicist.dev'
end

#reserved_pathsObject



79
80
81
# File 'lib/landable/configuration.rb', line 79

def reserved_paths
  @reserved_paths ||= []
end

#screenshots_enabledObject



99
100
101
# File 'lib/landable/configuration.rb', line 99

def screenshots_enabled
  @screenshots_enabled ||= false
end

#sitemap_additional_pathsObject



87
88
89
# File 'lib/landable/configuration.rb', line 87

def sitemap_additional_paths
  @sitemap_additional_paths ||= []
end

#sitemap_exclude_categoriesObject



83
84
85
# File 'lib/landable/configuration.rb', line 83

def sitemap_exclude_categories
  @sitemap_exclude_categories ||= []
end

#sitemap_hostObject



95
96
97
# File 'lib/landable/configuration.rb', line 95

def sitemap_host
  @sitemap_host
end

#sitemap_protocolObject



91
92
93
# File 'lib/landable/configuration.rb', line 91

def sitemap_protocol
  @sitemap_protocol ||= "http"
end

#traffic_enabledObject



103
104
105
# File 'lib/landable/configuration.rb', line 103

def traffic_enabled
  @traffic_enabled ||= false
end

Instance Method Details

#api_uriObject



27
28
29
30
31
# File 'lib/landable/configuration.rb', line 27

def api_uri
  if api_url.present?
    @api_uri ||= URI(api_url)
  end
end

#authenticatorsObject



13
14
15
# File 'lib/landable/configuration.rb', line 13

def authenticators
  @authenticators || raise("No Landable authenticator configured.")
end

#authenticators=(authenticators) ⇒ Object Also known as: authenticator=



17
18
19
# File 'lib/landable/configuration.rb', line 17

def authenticators=(authenticators)
  @authenticators = Array(authenticators)
end

#corsObject



112
113
114
# File 'lib/landable/configuration.rb', line 112

def cors
  @cors ||= CORS.new
end

#cors=(bool) ⇒ Object

Raises:

  • (ArgumentError)


116
117
118
119
# File 'lib/landable/configuration.rb', line 116

def cors=(bool)
  raise ArgumentError.new("Landable::Configuration#cors should be assigned 'false' to disable CORS support") if bool != false
  cors.origins = []
end

#public_uriObject



41
42
43
44
45
# File 'lib/landable/configuration.rb', line 41

def public_uri
  if public_url.present?
    @public_uri ||= URI(public_url)
  end
end

#screenshotsObject



135
136
137
# File 'lib/landable/configuration.rb', line 135

def screenshots
  @screenshots ||= Screenshots.new
end