Class: Turbo::Train::FanoutConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo/train/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFanoutConfiguration

Returns a new instance of FanoutConfiguration.



34
35
36
37
38
39
# File 'lib/turbo/train/config.rb', line 34

def initialize
  super
  @fastly_api_url = 'https://api.fastly.com'
  @service_url = 'https://johnny-cage-fake-url.edgecompute.app'
  @fastly_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
end

Instance Attribute Details

#fastly_api_urlObject

Returns the value of attribute fastly_api_url.



32
33
34
# File 'lib/turbo/train/config.rb', line 32

def fastly_api_url
  @fastly_api_url
end

#fastly_keyObject

Returns the value of attribute fastly_key.



32
33
34
# File 'lib/turbo/train/config.rb', line 32

def fastly_key
  @fastly_key
end

#service_idObject

Returns the value of attribute service_id.



32
33
34
# File 'lib/turbo/train/config.rb', line 32

def service_id
  @service_id
end

#service_urlObject

Returns the value of attribute service_url.



32
33
34
# File 'lib/turbo/train/config.rb', line 32

def service_url
  @service_url
end

Instance Method Details

#listen_url(topic) ⇒ Object



45
46
47
# File 'lib/turbo/train/config.rb', line 45

def listen_url(topic, **)
  "#{service_url}/stream/sse?topic=#{Turbo::Train.signed_stream_name(topic)}"
end

#publish_urlObject



41
42
43
# File 'lib/turbo/train/config.rb', line 41

def publish_url
  "#{@fastly_api_url}/service/#{@service_id}/publish/"
end