Class: WindowsLiveLogin::ConsentToken

Inherits:
Object
  • Object
show all
Defined in:
lib/contacts/windowslivelogin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wll, delegationtoken, refreshtoken, sessionkey, expiry, offers, locationid, context, decodedtoken, token) ⇒ ConsentToken

Initialize the ConsentToken module with the WindowsLiveLogin, delegation token, refresh token, session key, expiry, offers, location ID, context, decoded token, and raw token.



598
599
600
601
602
603
604
605
606
607
608
609
610
# File 'lib/contacts/windowslivelogin.rb', line 598

def initialize(wll, delegationtoken, refreshtoken, sessionkey, expiry,
               offers, locationid, context, decodedtoken, token)
  @wll = wll
  self.delegationtoken = delegationtoken
  self.refreshtoken = refreshtoken
  self.sessionkey = sessionkey
  self.expiry = expiry
  self.offers = offers
  self.locationid = locationid
  self.context = context
  self.decodedtoken = decodedtoken
  self.token = token
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



571
572
573
# File 'lib/contacts/windowslivelogin.rb', line 571

def context
  @context
end

#decodedtokenObject

Returns the value of attribute decodedtoken.



572
573
574
# File 'lib/contacts/windowslivelogin.rb', line 572

def decodedtoken
  @decodedtoken
end

#delegationtokenObject

Returns the value of attribute delegationtoken.



570
571
572
# File 'lib/contacts/windowslivelogin.rb', line 570

def delegationtoken
  @delegationtoken
end

#expiryObject

Returns the value of attribute expiry.



570
571
572
# File 'lib/contacts/windowslivelogin.rb', line 570

def expiry
  @expiry
end

#locationidObject

Returns the value of attribute locationid.



571
572
573
# File 'lib/contacts/windowslivelogin.rb', line 571

def locationid
  @locationid
end

#offersObject

Returns the value of attribute offers.



571
572
573
# File 'lib/contacts/windowslivelogin.rb', line 571

def offers
  @offers
end

#offers_stringObject

Returns the value of attribute offers_string.



571
572
573
# File 'lib/contacts/windowslivelogin.rb', line 571

def offers_string
  @offers_string
end

#refreshtokenObject

Returns the value of attribute refreshtoken.



570
571
572
# File 'lib/contacts/windowslivelogin.rb', line 570

def refreshtoken
  @refreshtoken
end

#sessionkeyObject

Returns the value of attribute sessionkey.



570
571
572
# File 'lib/contacts/windowslivelogin.rb', line 570

def sessionkey
  @sessionkey
end

#tokenObject

Returns the value of attribute token.



572
573
574
# File 'lib/contacts/windowslivelogin.rb', line 572

def token
  @token
end

Instance Method Details

#isValid?Boolean

Indicates whether the delegation token is set and has not expired.

Returns:

  • (Boolean)


577
578
579
580
# File 'lib/contacts/windowslivelogin.rb', line 577

def isValid?
  return false unless delegationtoken
  return ((Time.now.to_i-300) < expiry.to_i)
end

#refreshObject

Refreshes the current token and replace it. If operation succeeds true is returned to signify success.



586
587
588
589
590
591
# File 'lib/contacts/windowslivelogin.rb', line 586

def refresh
  ct = @wll.refreshConsentToken(self)
  return false unless ct
  copy(ct)
  true
end