Class: Twilio::JWT::AccessToken

Inherits:
BaseJWT
  • Object
show all
Defined in:
lib/twilio-ruby/jwt/access_token.rb

Defined Under Namespace

Classes: ChatGrant, ConversationsGrant, IpMessagingGrant, SyncGrant, TaskRouterGrant, VideoGrant, VoiceGrant

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseJWT

#headers, #payload, #to_jwt

Constructor Details

#initialize(account_sid, signing_key_sid, secret, grants = [], identity: nil, nbf: nil, ttl: 3600, valid_until: nil) ⇒ AccessToken

Returns a new instance of AccessToken.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/twilio-ruby/jwt/access_token.rb', line 23

def initialize(
  ,
  signing_key_sid,
  secret,
  grants = [],
  identity: nil,
  nbf: nil,
  ttl: 3600,
  valid_until: nil
)
  super(secret_key: secret,
        issuer: signing_key_sid,
        subject: ,
        nbf: nbf,
        ttl: ttl,
        valid_until: valid_until)
  @account_sid = 
  @signing_key_sid = signing_key_sid
  @secret = secret
  @identity = identity
  @nbf = nbf
  @grants = grants
  @ttl = ttl
  @valid_until = valid_until
end

Instance Attribute Details

#account_sidObject

Returns the value of attribute account_sid.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def 
  @account_sid
end

#grantsObject

Returns the value of attribute grants.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def grants
  @grants
end

#identityObject

Returns the value of attribute identity.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def identity
  @identity
end

#nbfObject

Returns the value of attribute nbf.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def nbf
  @nbf
end

#secretObject

Returns the value of attribute secret.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def secret
  @secret
end

#signing_key_idObject

Returns the value of attribute signing_key_id.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def signing_key_id
  @signing_key_id
end

#ttlObject

Returns the value of attribute ttl.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def ttl
  @ttl
end

#valid_untilObject

Returns the value of attribute valid_until.



14
15
16
# File 'lib/twilio-ruby/jwt/access_token.rb', line 14

def valid_until
  @valid_until
end

Instance Method Details

#add_grant(grant) ⇒ Object



49
50
51
# File 'lib/twilio-ruby/jwt/access_token.rb', line 49

def add_grant(grant)
  @grants.push(grant)
end