Class: SimpleSDKBuilder::SearchResults

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_sdk_builder/search_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, type) ⇒ SearchResults

Returns a new instance of SearchResults.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/simple_sdk_builder/search_results.rb', line 6

def initialize(response, type)
  @result_count = response.headers['X-Count'].to_s.to_i

  @links = {}
  response.headers['Link'].to_s.split(',').each do |link|
    if link =~ /<(.*)>; rel="(.*)"/
      @links[$2] = $1
    end
  end

  @results = response.build(type)
end

Instance Attribute Details

Returns the value of attribute links.



4
5
6
# File 'lib/simple_sdk_builder/search_results.rb', line 4

def links
  @links
end

#result_countObject (readonly)

Returns the value of attribute result_count.



4
5
6
# File 'lib/simple_sdk_builder/search_results.rb', line 4

def result_count
  @result_count
end

#resultsObject (readonly)

Returns the value of attribute results.



4
5
6
# File 'lib/simple_sdk_builder/search_results.rb', line 4

def results
  @results
end