Class: KinesisCat::Client
- Inherits:
-
Object
- Object
- KinesisCat::Client
- Defined in:
- lib/kinesis_cat/client.rb
Instance Method Summary collapse
-
#initialize(client, options) ⇒ Client
constructor
A new instance of Client.
- #put(data, options = {}) ⇒ Object
Constructor Details
#initialize(client, options) ⇒ Client
Returns a new instance of Client.
2 3 4 5 |
# File 'lib/kinesis_cat/client.rb', line 2 def initialize(client, ) @client = client @options = end |
Instance Method Details
#put(data, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kinesis_cat/client.rb', line 7 def put(data, = {}) = @options.merge() partition_key = [:partition_key] partition_key ||= Time.now.to_i.to_s if data.kind_of?(Hash) data = JSON.dump(data) end @client.put_record( :stream_name => .fetch(:stream_name), :data => data, :partition_key => partition_key, ) end |