While trying to run some simple code (quoted below) I wrote in Ruby (using RoR) that is supposed to create an OpenTok session I receive the mentioned error.
api_key = "4W3S0M3K3Y"
api_secret = "it's secret!"
opentok = OpenTok::OpenTokSDK.new api_key, api_secret
session_properties = {OpenTok::SessionPropertyConstants::P2P_PREFERENCE => "disabled"}
session = opentok.create_session request.remote_addr, session_properties # <--- this is the buggy line
ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
rails 3.2.6
opentok 0.0.7
A little bit of additional information I got when running the code from rails console:
irb(main):006:0> session = opentok.create_session "localhost", session_properties
TypeError: can't convert Pathname into String
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:776:in `initialize'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:776:in `new'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:776:in `connect'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:744:in `start'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/opentok-0.0.7/lib/open_tok/open_tok_sdk.rb:170:in `do_request'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/opentok-0.0.7/lib/open_tok/open_tok_sdk.rb:125:in `create_session'
from (irb):6
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have searched the depths of the internet looking for a solution... unfortunately I failed.
The most fierce discussion regarding this topic that I have found is under this link, though I seem to be unable to comprehend what "follow the OpenTok API/Doc without using the gem" means.
The server-side documentation sends me off to an appropriate project at github where the Installation section tells me to install the gem (unless I've missed that particular piece of information about using the server-side API without the gem).
I would be grateful for any help at all that might get me closer to solving this problem.
Yours truly,
zgredzik (real tongue twister, I know)