Class: FaaStRuby::Subscriber
- Inherits:
-
Object
- Object
- FaaStRuby::Subscriber
- Defined in:
- lib/faastruby/server/subscriber.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #call(encoded_data) ⇒ Object
-
#initialize(path) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(path) ⇒ Subscriber
Returns a new instance of Subscriber.
4 5 6 7 |
# File 'lib/faastruby/server/subscriber.rb', line 4 def initialize(path) @path = path @workspace_name, @function_name = @path.split("/") end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/faastruby/server/subscriber.rb', line 3 def path @path end |
Instance Method Details
#call(encoded_data) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/faastruby/server/subscriber.rb', line 9 def call(encoded_data) data = Base64.urlsafe_decode64(encoded_data) headers = {'X-Origin' => 'event_hub', 'Content-Transfer-Encoding' => 'base64'} event = Event.new(body: data, query_params: {}, headers: headers, context: nil) Runner.new.call(@workspace_name, @function_name, event, []) end |