Class: Heroku::Samorau::Sso

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/samorau.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



459
460
461
# File 'lib/heroku/samorau.rb', line 459

def id
  @id
end

#urlObject

Returns the value of attribute url.



459
460
461
# File 'lib/heroku/samorau.rb', line 459

def url
  @url
end

Instance Method Details

#full_urlObject



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)}&timestamp=#{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

#pathObject



467
468
469
# File 'lib/heroku/samorau.rb', line 467

def path
  "/heroku/resources/#{id}"
end