class StreamData::Stream

Public Class Methods

send_raw_data(raw_data) click to toggle source
# File lib/stream.rb, line 22
def self.send_raw_data(raw_data)
        begin
                @firehose.put_record({ delivery_stream_name: @config["delivery_stream_name"],  record: { data: raw_data}})
        rescue Aws::Errors::MissingCredentialsError => e
                raise (StandardError.new("Error with the connection. Check the config. Error message === #{e.message}"))
        end
end
send_stream(config,raw_data) click to toggle source
# File lib/stream.rb, line 4
def self.send_stream(config,raw_data)
        set_connection(config)
        send_raw_data(raw_data)
end
set_connection(config) click to toggle source
# File lib/stream.rb, line 9
def self.set_connection(config)
        @config = 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