Class: Echo::Search
Instance Method Summary collapse
- #build_query(options) ⇒ Object
- #fetch(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(options = {}) ⇒ Search
Returns a new instance of Search.
6 7 8 9 10 |
# File 'lib/echor/search.rb', line 6 def initialize(={}) self.class.class_eval do base_uri Echo.endpoint end end |
Instance Method Details
#build_query(options) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/echor/search.rb', line 14 def build_query() raise ArgumentError unless [:q] raise ArgumentError unless Echo.user [:appkey] = Echo.user "/search?#{options.to_query}" end |
#fetch(options = {}) ⇒ Object
23 24 25 |
# File 'lib/echor/search.rb', line 23 def fetch(={}) self.class.get(build_query()) end |