Class: Heroku::Samorau::Sso
- Inherits:
-
Object
- Object
- Heroku::Samorau::Sso
- Defined in:
- lib/heroku/samorau.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #full_url ⇒ Object
-
#initialize(data) ⇒ Sso
constructor
A new instance of Sso.
- #make_token(t) ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(data) ⇒ Sso
Returns a new instance of Sso.
461 462 463 464 465 |
# File 'lib/heroku/samorau.rb', line 461 def initialize(data) @id = data[:id] @salt = data['api']['sso_salt'] @url = data["api"]["test"].chomp('/') end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
459 460 461 |
# File 'lib/heroku/samorau.rb', line 459 def id @id end |
#url ⇒ Object
Returns the value of attribute url.
459 460 461 |
# File 'lib/heroku/samorau.rb', line 459 def url @url end |
Instance Method Details
#full_url ⇒ Object
471 472 473 474 |
# File 'lib/heroku/samorau.rb', line 471 def full_url t = Time.now.to_i "#{url}#{path}?token=#{make_token(t)}×tamp=#{t}" end |
#make_token(t) ⇒ Object
476 477 478 |
# File 'lib/heroku/samorau.rb', line 476 def make_token(t) Digest::SHA1.hexdigest([@id, @salt, t].join(':')) end |
#path ⇒ Object
467 468 469 |
# File 'lib/heroku/samorau.rb', line 467 def path "/heroku/resources/#{id}" end |