Module: AktivlearnStream

Defined in:
lib/config.rb,
lib/stream.rb,
lib/aktivlearn_stream.rb

Defined Under Namespace

Classes: Config, Stream

Class Method Summary collapse

Class Method Details

.read_config(config) ⇒ Object



5
6
7
8
9
# File 'lib/aktivlearn_stream.rb', line 5

def self.read_config config
  @config = config
  AktivlearnStream::Config.validate_config(@config)
  set_connection
end

.send(raw_data) ⇒ Object



25
26
27
# File 'lib/aktivlearn_stream.rb', line 25

def self.send(raw_data)
  AktivlearnStream::Stream.send_raw_data(@config,@firehose,raw_data)
end

.set_connectionObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/aktivlearn_stream.rb', line 12

def self.set_connection
  @config ||= {}
  begin
    @firehose = Aws::Firehose::Client.new(
    access_key_id: @config["service_key"],
    secret_access_key: @config["service_secret"],
    region: @config["region"]
    )
  rescue Exception => e
    raise (StandardError.new("Could not establish a connection. Check the config. Error message === #{e.message}"))
  end
end