class GoogleKnowledgeGraph::Entity

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 5
def initialize data
  @data = data
end

Public Instance Methods

description() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 37
def description
  @data['description']
end
description_text() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 45
def description_text
  detailed_description&.dig 'articleBody'
end
description_url() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 49
def description_url
  detailed_description&.dig 'url'
end
detailed_description() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 41
def detailed_description
  @data['detailedDescription']
end
id() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 9
def id
  @data['@id']
end
id_without_prefix() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 13
def id_without_prefix
  id.delete_prefix 'kg:'
end
image() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 29
def image
  @data['image']
end
image_url() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 33
def image_url
  @data.dig 'image', 'contentUrl'
end
name() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 21
def name
  @data['name']
end
types() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 17
def types
  @data['@type']
end
url() click to toggle source
# File lib/google_knowledge_graph/entity.rb, line 25
def url
  @data['url']
end