Class: Teleportd::Search

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/teleportd/search.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Search

Returns a new instance of Search.



13
14
15
16
# File 'lib/teleportd/search.rb', line 13

def initialize opts={}
  @opts    = opts
  @request = Request.new(request_uri)
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



11
12
13
# File 'lib/teleportd/search.rb', line 11

def opts
  @opts
end

Class Method Details

.potential_available_filtersObject



6
7
8
# File 'lib/teleportd/search.rb', line 6

def potential_available_filters
  [:location, :textual_search, :time_period, :size_filter, :from_filter, :sort_filter]
end

Instance Method Details

#eachObject



22
23
24
# File 'lib/teleportd/search.rb', line 22

def each
  results.each {|member| yield member}
end

#resultsObject



18
19
20
# File 'lib/teleportd/search.rb', line 18

def results
  @results ||= parsed_response["hits"].map{|r|SearchResult.new(r)}
end