Permalink
Browse files

sapo id added

  • Loading branch information...
tpinto committed Apr 20, 2009
1 parent c96ab0c commit 7a715dd2095cd27f2476b6576b24b27e4f7f643d
Showing with 26 additions and 1 deletion.
  1. +12 −1 lib/sapo.rb
  2. +14 −0 lib/sapo/id.rb
View
@@ -6,6 +6,16 @@ module SAPO
require 'json'
require 'rexml/document'
require 'net/http'
+require 'net/https'
+require 'open-uri'
+require 'openssl'
+
+module OpenSSL
+ module SSL
+ remove_const :VERIFY_PEER
+ end
+end
+OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
require 'sapo/adsl'
require 'sapo/adwords'
@@ -14,4 +24,5 @@ module SAPO
require 'sapo/jobs'
require 'sapo/photos'
require 'sapo/shopping'
-require 'sapo/traffic'
+require 'sapo/traffic'
+require 'sapo/id'
View
@@ -0,0 +1,14 @@
+module SAPO
+ class ID
+ attr_accessor :email, :password, :primary, :token
+
+ def initialize(email, password)
+ self.email = email
+ self.password = password
+
+ output = REXML::Document.new(open("https://services.sapo.pt/STS/GetPrimaryId?ESBUsername=#{self.email}&ESBPassword=#{self.password}").read)
+ self.primary = output.root.elements['PrimaryId'].text
+ self.token = output.root.elements['ESBToken'].text
+ end
+ end
+end

0 comments on commit 7a715dd

Please sign in to comment.