Class: Twilio::JWT::ClientCapability::EventStreamScope

Inherits:
Object
  • Object
show all
Includes:
Scope
Defined in:
lib/twilio-ruby/jwt/client_capability.rb

Instance Method Summary collapse

Constructor Details

#initialize(filters = {}) ⇒ EventStreamScope

Returns a new instance of EventStreamScope.



84
85
86
87
# File 'lib/twilio-ruby/jwt/client_capability.rb', line 84

def initialize(filters = {})
  @filters = filters
  @path = '/2010-04-01/Events'
end

Instance Method Details

#_generate_payloadObject



89
90
91
92
93
94
95
96
97
98
# File 'lib/twilio-ruby/jwt/client_capability.rb', line 89

def _generate_payload
  prefix = 'scope:stream:subscribe'
  path = "path=#{CGI.escape(@path)}"
  unless @filters.empty?
    filters = 'params=' + @filters.map { |k, v| CGI.escape("#{k}=#{v}") }.join('&')
  end

  suffix = [path, filters].compact.join('&')
  [prefix, suffix].join('?')
end