Class: RichSnippet::JobPosting

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

Instance Method Summary collapse

Methods inherited from Thing

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

Instance Method Details

#to_json(render_childs = false) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/rich_snippet/job_posting.rb', line 18

def to_json(render_childs = false)
  {
    "@context": "http://schema.org",
    "@type": "JobPosting",
    name: name,
    description: description,
    image: image ? image.binary_url : nil,
    url: url,
    baseSalary: base_salary,
    datePosted: date_posted,
    educationRequirements: education_requirements,
    employmentType: employment_type,
    experienceRequirements: experience_requirements,
    hiringOrganization: hiring_organization ? hiring_organization.to_json : nil,
    jobBenefits: job_benefits,
    jobLocation: {
      "@context": "http://schema.org",
      "@type": "Place",
      address: job_location ? job_location.to_json : nil,
    },
    qualifications: qualifications,
    salaryCurrency: salary_currency,
    skills: skills,
    title: job_title,
    validThrough: valid_through,
    workHours: work_hours
  }.delete_if { |k, v| !v.present? }
end