Permalink
Browse files

added connect getUiUrl

  • Loading branch information...
1 parent a9c2550 commit 29f0a3f4839e4a21218edcc85b5500a7171137bd @kr1sp1n committed Apr 19, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/zanox.rb
View
13 lib/zanox.rb
@@ -54,22 +54,24 @@ def self.create_signature(secret_key, string2sign)
module Session
attr_accessor :connect_id
attr_accessor :secret_key
+ attr_accessor :session_key
attr_accessor :offline_token
def self.new(auth_token)
- response = Zanox::Connect.request("getSession", {:authToken=>auth_token})
+ response = Zanox::Connect.request("getSession", {:authToken=>auth_token, :publicKey=>Zanox::API.public_key})
self.map(response)
end
def self.offline(offline_token)
- response = Zanox::Connect.request("getOfflineSession", {:offlineToken=>offline_token})
+ response = Zanox::Connect.request("getOfflineSession", {:offlineToken=>offline_token, :publicKey=>Zanox::API.public_key})
(self.map(response)) ? response.session : {:error=>"error!!! offline session"}
end
def map(response)
if(response.respond_to?(:session))
@connect_id = response.session.connectId
@secret_key = response.session.secretKey
+ @session_key = response.session.sessionKey
@offline_token = (response.session.respond_to?(:offlineToken)) ? response.session.offlineToken : nil
true
else
@@ -93,9 +95,8 @@ module Connect
attr_accessor :wsdl
attr_accessor :driver
- def self.request(method, options)
+ def self.request(method, options={})
begin
- options.merge!(:publicKey=>Zanox::API.public_key)
unless Zanox::API.secret_key.nil?
timestamp = Zanox::API.get_timestamp
@@ -116,6 +117,10 @@ def self.request(method, options)
end
end
+ def self.ui_url
+ Zanox::Connect.request("getUiUrl", :connectId=>Zanox::API::Session.connect_id, :sessionKey=>Zanox::API::Session.session_key)
+ end
+
self.instance_methods.each do |method|
module_function method.to_sym
end

0 comments on commit 29f0a3f

Please sign in to comment.