Class: SellDotCom::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/selldotcom/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_phrase) ⇒ Search

Returns a new instance of Search.



7
8
9
10
# File 'lib/selldotcom/search.rb', line 7

def initialize(search_phrase)
  @search_phrase  ||= search_phrase
  @search_uri     ||= search_uri
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



5
6
7
# File 'lib/selldotcom/search.rb', line 5

def results
  @results
end

#search_phraseObject

Returns the value of attribute search_phrase.



4
5
6
# File 'lib/selldotcom/search.rb', line 4

def search_phrase
  @search_phrase
end

Instance Method Details

#searchObject



12
13
14
15
# File 'lib/selldotcom/search.rb', line 12

def search
  response = Typhoeus::Request.get(@search_uri)
  @results = parse(response.body)
end