Class: Twilio::JWT::AccessToken

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

Defined Under Namespace

Classes: ChatGrant, PlaybackGrant, 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, region: nil) ⇒ AccessToken

Returns a new instance of AccessToken.



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

def initialize(
  ,
  signing_key_sid,
  secret,
  grants = [],
  identity: nil,
  nbf: nil,
  ttl: 3600,
  valid_until: nil,
  region: 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
  @region = region
end

Instance Attribute Details

#account_sidObject

Returns the value of attribute account_sid.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def 
  @account_sid
end

#grantsObject

Returns the value of attribute grants.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def grants
  @grants
end

#identityObject

Returns the value of attribute identity.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def identity
  @identity
end

#nbfObject

Returns the value of attribute nbf.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def nbf
  @nbf
end

#regionObject

Returns the value of attribute region.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def region
  @region
end

#secretObject

Returns the value of attribute secret.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def secret
  @secret
end

#signing_key_idObject

Returns the value of attribute signing_key_id.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def signing_key_id
  @signing_key_id
end

#ttlObject

Returns the value of attribute ttl.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def ttl
  @ttl
end

#valid_untilObject

Returns the value of attribute valid_until.



16
17
18
# File 'lib/twilio-ruby/jwt/access_token.rb', line 16

def valid_until
  @valid_until
end

Instance Method Details

#add_grant(grant) ⇒ Object



54
55
56
# File 'lib/twilio-ruby/jwt/access_token.rb', line 54

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