lib/acouchi/solo.rb in acouchi-0.0.9 vs lib/acouchi/solo.rb in acouchi-0.0.10
- old
+ new
@@ -5,10 +5,14 @@
class Solo
MENU = 82
LEFT = 21
RIGHT = 22
+ def initialize(configuration)
+ @configuration = configuration
+ end
+
def send_key key
call_method("sendKey", [key])
end
def enter_text text, index=0
@@ -129,10 +133,10 @@
private
def call_method name, arguments = []
arguments = arguments.map {|a| a.to_s}
options = { :body => {:parameters => arguments.to_json} }
- response = HTTParty.post("http://127.0.0.1:7103/execute_method/#{name}", options)
+ response = HTTParty.post("http://127.0.0.1:#{@configuration.port}/execute_method/#{name}", options)
json = JSON.parse(response.body, :max_nesting => 100)
if json.empty?
nil
else
json["result"]