Class: Wduck::DuckHelper::SearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/wduck/duck_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ SearchResult

Returns a new instance of SearchResult.



15
16
17
18
19
20
21
22
# File 'lib/wduck/duck_helper.rb', line 15

def initialize(query)
  @parsed_data    = get_json_data query
  @heading        = check_data "Heading"
  @source         = check_data "AbstractSource"
  @answer         = check_data "Answer"
  @abstract       = check_data "AbstractText"
  @related_topics = check_data "RelatedTopics"
end

Instance Attribute Details

#abstractObject (readonly)

Returns the value of attribute abstract.



13
14
15
# File 'lib/wduck/duck_helper.rb', line 13

def abstract
  @abstract
end

#answerObject (readonly)

Returns the value of attribute answer.



13
14
15
# File 'lib/wduck/duck_helper.rb', line 13

def answer
  @answer
end

#headingObject (readonly)

Returns the value of attribute heading.



13
14
15
# File 'lib/wduck/duck_helper.rb', line 13

def heading
  @heading
end

Returns the value of attribute related_topics.



13
14
15
# File 'lib/wduck/duck_helper.rb', line 13

def related_topics
  @related_topics
end

#sourceObject (readonly)

Returns the value of attribute source.



13
14
15
# File 'lib/wduck/duck_helper.rb', line 13

def source
  @source
end