lib/acouchi/solo.rb in acouchi-0.0.5 vs lib/acouchi/solo.rb in acouchi-0.0.6

- old
+ new

@@ -2,38 +2,36 @@ require "json" module Acouchi class Solo MENU = 82 + LEFT = 21 + RIGHT = 22 def send_key key - call_method("sendKey", [{:type => "int", :value => key}]) + call_method("sendKey", [key]) end def enter_text index, text - call_method("enterText", [ - {:type => "int", :value => index}, - {:type => "java.lang.String", :value => text} - ]) + call_method("enterText", [index, text]) end def clear_edit_text index - call_method("clearEditText", [{:type => "int", :value => index}]) + call_method("clearEditText", [index]) end def has_text? text, options={} options = { :scroll => true, :minimum_matches => 0, :must_be_visible => true }.merge(options) - call_method("searchText", [ - {:type => "java.lang.String", :value => text}, - {:type => "int", :value => options[:minimum_matches]}, - {:type => "boolean", :value => options[:scroll]}, - {:type => "boolean", :value => options[:must_be_visible]} + text, + options[:minimum_matches], + options[:scroll], + options[:must_be_visible] ]) end def buttons call_method("getCurrentButtons") @@ -50,26 +48,23 @@ def click_text text, options={} options = { :match => 1, :auto_scroll => true }.merge(options) - call_method("clickOnText", [ - {:type => "java.lang.String", :value => text}, - {:type => "int", :value => options[:match]}, - {:type => "boolean", :value => options[:auto_scroll]} + text, + options[:match], + options[:auto_scroll] ]) end def views call_method("getViews") end def click_view id - call_method("clickOnViewById", [ - {:type => "int", :value => id}, - ]) + call_method("clickOnViewById", [id]) end def scroll_up call_method("scrollUp") end @@ -77,18 +72,22 @@ def scroll_down call_method("scrollDown") end def scroll_up_list index=0 - call_method("scrollUpList", [ - {:type => "int", :value => index} - ]) + call_method("scrollUpList", [index]) end def scroll_down_list index=0 - call_method("scrollDownList", [ - {:type => "int", :value => index} - ]) + call_method("scrollDownList", [index]) + end + + def scroll_to_left + call_method("scrollToSide", [LEFT]) + end + + def scroll_to_right + call_method("scrollToSide", [RIGHT]) end private def call_method name, arguments = [] options = { :body => {:parameters => arguments.to_json} }