Class: RichSnippet::Organization

Inherits:
Thing
  • Object
show all
Defined in:
app/models/rich_snippet/organization.rb

Instance Method Summary collapse

Methods inherited from Thing

#array_json, #module, #name, #type, #warnings

Instance Method Details

#to_json(render_childs = false) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/rich_snippet/organization.rb', line 13

def to_json(render_childs = false)
  {
    "@context": "http://schema.org",
    "@type": "Organization",
    name: name,
    description: description,
    image: image ? image.binary_url : '',
    url: url,
    address: address ? address.to_json : nil,
    founder: founder ? founder.to_json : nil,
    foundingDate: founding_date,
    legalName: legal_name,
    logo:  ? .binary_url : nil,
    numberOfEmployees: number_of_employees,
    parentOrganization: parent_organization ? parent_organization.to_json : nil,
    subOrganizations: array_json(sub_organizations),
    telephone: telephone
  }.delete_if { |k, v| !v.present? }
end