lib/twilio-ruby/jwt/access_token.rb in twilio-ruby-5.0.0.rc14 vs lib/twilio-ruby/jwt/access_token.rb in twilio-ruby-5.0.0.rc15

- old
+ new

@@ -23,12 +23,11 @@ end def to_jwt(algorithm='HS256') now = Time.now.to_i - 1 headers = { - cty: 'twilio-fpa;v=1', - typ: 'JWT' + cty: 'twilio-fpa;v=1' } grants = {} if @identity grants[:identity] = @identity @@ -102,9 +101,44 @@ end payload end + end + + class VoiceGrant + attr_accessor :outgoing_application_sid, + :outgoing_application_params, + :push_credential_sid, + :endpoint_id + + def key + 'voice' + end + + def payload + payload = {} + + if outgoing_application_sid + outgoing = {} + outgoing[:application_sid] = outgoing_application_sid + if outgoing_application_params + outgoing[:params] = outgoing_application_params + end + + payload[:outgoing] = outgoing + end + + if push_credential_sid + payload[:push_credential_sid] = push_credential_sid + end + + if endpoint_id + payload[:endpoint_id] = endpoint_id + end + + payload + end end end end end \ No newline at end of file