summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-10-13 11:44:34 -0600
committermo khan <mo@mokhan.ca>2014-10-13 11:44:34 -0600
commitdd53c55a98cbb965fd5947e288e5e10f96843101 (patch)
tree51815a74f8dd9ab5f867c01b10440e1b3a56ad9b /app/controllers/admin
parenta8f0c11dd54ca68c3059bc908e61da3b9a83fe74 (diff)
add tools page to admin section to search the Amazon Product API.
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/tools_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/admin/tools_controller.rb b/app/controllers/admin/tools_controller.rb
new file mode 100644
index 00000000..0bae31ad
--- /dev/null
+++ b/app/controllers/admin/tools_controller.rb
@@ -0,0 +1,15 @@
+module Admin
+ class ToolsController < AdminController
+ def index
+ @tools = search_for_tools(params[:q])
+ end
+
+ private
+
+ def search_for_tools(query)
+ return [] if query.blank?
+ client = ASIN::Client.instance
+ client.search(Keywords: query, SearchIndex: :Kitchen, Sort: :salesrank)
+ end
+ end
+end