Class: BestMatchResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/dto/search/best_match_response.rb

Overview

Class BestMatchResponse represents server response on best_match Search API request. Server response is sent to initializer which creates objects with attributes category, numResults accessible via getters:

  • category

  • num_results

  • numResults

Examples:

response = BestMatchResponse.new("category" => "VAUT", "numResults" => 20)
response.category     # => "VAUT"
response.numResults   # => 20
response.num_results  # => 20

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

from_array, from_hash

Constructor Details

#initialize(hash = {}) ⇒ BestMatchResponse

Returns a new instance of BestMatchResponse.



20
21
22
23
24
# File 'lib/dto/search/best_match_response.rb', line 20

def initialize(hash = {})
  hash.each do |key, value|
    self.send("#{key}=".to_sym, value )
  end
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



15
16
17
# File 'lib/dto/search/best_match_response.rb', line 15

def category
  @category
end

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



15
16
17
# File 'lib/dto/search/best_match_response.rb', line 15

def error
  @error
end

#numResultsObject

Returns the value of attribute numResults

Returns:

  • (Object)

    the current value of numResults



15
16
17
# File 'lib/dto/search/best_match_response.rb', line 15

def numResults
  @numResults
end