Class: SerpCheap::KnowledgeGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/serpcheap/models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, image_url: nil, description: nil, description_source: nil, description_link: nil, attributes: nil) ⇒ KnowledgeGraph

Returns a new instance of KnowledgeGraph.



93
94
95
96
97
98
99
100
# File 'lib/serpcheap/models.rb', line 93

def initialize(title:, image_url: nil, description: nil, description_source: nil, description_link: nil, attributes: nil)
  @title = title
  @image_url = image_url
  @description = description
  @description_source = description_source
  @description_link = description_link
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def attributes
  @attributes
end

#descriptionObject (readonly)

Returns the value of attribute description.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def description
  @description
end

Returns the value of attribute description_link.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def description_link
  @description_link
end

#description_sourceObject (readonly)

Returns the value of attribute description_source.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def description_source
  @description_source
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def image_url
  @image_url
end

#titleObject (readonly)

Returns the value of attribute title.



91
92
93
# File 'lib/serpcheap/models.rb', line 91

def title
  @title
end

Class Method Details

.from_hash(d) ⇒ Object



102
103
104
105
106
107
108
109
110
111
# File 'lib/serpcheap/models.rb', line 102

def self.from_hash(d)
  new(
    title: d["title"].to_s,
    image_url: d["imageUrl"],
    description: d["description"],
    description_source: d["descriptionSource"],
    description_link: d["descriptionLink"],
    attributes: d["attributes"]
  )
end