Class: PageStructuredData::PageTypes::Organization
- Inherits:
-
Object
- Object
- PageStructuredData::PageTypes::Organization
- Includes:
- SchemaNode
- Defined in:
- app/src/page_structured_data/page_types/organization.rb
Overview
Organization structured data for a page
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#founder ⇒ Object
readonly
Returns the value of attribute founder.
-
#logo ⇒ Object
readonly
Returns the value of attribute logo.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_organization ⇒ Object
readonly
Returns the value of attribute parent_organization.
-
#same_as ⇒ Object
readonly
Returns the value of attribute same_as.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(name:, url:, description: nil, logo: nil, same_as: [], parent_organization: nil, founder: nil) ⇒ Organization
constructor
A new instance of Organization.
- #json_ld ⇒ Object
-
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(name:, url:, description: nil, logo: nil, same_as: [], parent_organization: nil, founder: nil) ⇒ Organization
Returns a new instance of Organization.
11 12 13 14 15 16 17 18 19 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 11 def initialize(name:, url:, description: nil, logo: nil, same_as: [], parent_organization: nil, founder: nil) @name = name @url = url @description = description @logo = logo @same_as = Array(same_as) @parent_organization = parent_organization @founder = founder end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def description @description end |
#founder ⇒ Object (readonly)
Returns the value of attribute founder.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def founder @founder end |
#logo ⇒ Object (readonly)
Returns the value of attribute logo.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def logo @logo end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def name @name end |
#parent_organization ⇒ Object (readonly)
Returns the value of attribute parent_organization.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def parent_organization @parent_organization end |
#same_as ⇒ Object (readonly)
Returns the value of attribute same_as.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def same_as @same_as end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 9 def url @url end |
Instance Method Details
#json_ld ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 35 def json_ld %( <script type="application/ld+json"> #{to_h.to_json} </script> ) end |
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/src/page_structured_data/page_types/organization.rb', line 21 def to_h # rubocop:disable Metrics/MethodLength compact_node( '@context': 'https://schema.org', '@type': 'Organization', name: name, url: url, description: description, logo: logo, sameAs: same_as, founder: object_to_h(founder), parentOrganization: parent_organization_to_h ) end |