Sha256: f34f7bcd0c963f7bea345bb06e6b8e2997c49f61863b31703296f0c83c032e3d

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

require 'date'
require 'schema_dot_org'


module SchemaDotOrg
  class Organization < SchemaType
    attr_accessor :email, :founder, :founding_date, :founding_location, :logo, :name, :url

    validates :email,             type: String
    validates :founder,           type: Person
    validates :founding_date,     type: Date
    validates :founding_location, type: Place
    validates :logo,              type: String
    validates :name,              type: String
    validates :url,               type: String

    def to_json_struct
      {
        "@type" => "Organization",
        "name" => name,
        "email" => email,
        "url" => url,
        "logo" => logo,
        "founder" => founder.to_json_struct,
        "foundingDate" => founding_date.to_s,
        "foundingLocation" => founding_location.to_json_struct
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schema_dot_org-1.0.1 lib/schema_dot_org/organization.rb