Class: Cloudrider::Protosite

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudrider/protosite.rb

Overview

protopage_example =

name: oneof KnownPages,
components: someof KnownComponents

Defined Under Namespace

Classes: Protopage

Constant Summary collapse

KnownPages =
[:index, :products_index, :product_show, :about_us, :contact_us, :offers_new]
KnownFunctionalities =
[:admin_panel, :user_accounts, :public_offer, :categorizable_products]
KnownThemes =
[:craigslist, :material, :amateur, :girly, :flat]
KnownLayouts =
[
  "full-width, triple-column", # https://medium.com/@erikdkennedy/7-rules-for-creating-gorgeous-ui-part-1-559d4e805cda?hn=1 wikipedia redesign
  "full-width, double-column", # circa 2014 wikipedia
  "full-width, single-column", # full page sites (i.e. gamified sites)
  "mixed-width, hero-full", # like the tons of profile pages out there
  "mixed-width, hero-narrow", # bootstrap circa 2011
  "narrow-width" # circa 2007 yahoo
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#domain_namesObject

Returns the value of attribute domain_names.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def domain_names
  @domain_names
end

#functionalitiesObject

Returns the value of attribute functionalities.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def functionalities
  @functionalities
end

#layoutObject

Returns the value of attribute layout.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def layout
  @layout
end

#pagesObject

Returns the value of attribute pages.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def pages
  @pages
end

#project_nameObject

Returns the value of attribute project_name.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def project_name
  @project_name
end

#themeObject

Returns the value of attribute theme.



38
39
40
# File 'lib/cloudrider/protosite.rb', line 38

def theme
  @theme
end

Class Method Details

.from_hash(hash) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cloudrider/protosite.rb', line 26

def self.from_hash(hash)
  symbolized_hash = hash.symbolize_keys
  new.tap do |p|
    p.project_name = symbolized_hash[:project_name]
    p.domain_names = symbolized_hash[:domain_names]
    p.theme = symbolized_hash[:theme]
    p.layout = symbolized_hash[:layout]
    p.squash_api_key = symbolized_hash[:squash_api_key]
    p.functionalities = symbolized_hash[:functionalities]
    p.pages = symbolized_hash[:pages].to_a.map { |page_hash| Protopage.new page_hash.symbolize_keys }
  end
end

Instance Method Details

#private_offer?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/cloudrider/protosite.rb', line 44

def private_offer?
  !functionalities.include?("public_offer") && pages.any? { |page| page.name == "offers_new" }
end

#public_offer?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/cloudrider/protosite.rb', line 40

def public_offer?
  functionalities.include?("public_offer") && pages.any? { |page| page.name == "offers_new" }
end