Class: TreatanyoneCommonApi::Kinesis
- Inherits:
-
Object
- Object
- TreatanyoneCommonApi::Kinesis
- Defined in:
- lib/treatanyone_common_api/kinesis.rb
Constant Summary collapse
- DEFAULT_REGION =
"us-west-2".freeze
- DEFAULT_STREAM_NAME =
"treatanyone-domain-stream-dev".freeze
Instance Attribute Summary collapse
-
#aggregate_type ⇒ Object
readonly
Returns the value of attribute aggregate_type.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#lambda_arn ⇒ Object
readonly
Returns the value of attribute lambda_arn.
-
#model_object ⇒ Object
readonly
Returns the value of attribute model_object.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(event_type, model_object, user_id, options = {}) ⇒ Kinesis
constructor
A new instance of Kinesis.
- #publish_event ⇒ Object
Constructor Details
#initialize(event_type, model_object, user_id, options = {}) ⇒ Kinesis
Returns a new instance of Kinesis.
13 14 15 16 17 18 19 20 21 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 13 def initialize(event_type, model_object, user_id, = {}) @event_type = event_type @model_object = model_object @user_id = user_id @data = [:data] @aggregate_type = [:aggregate_type].presence || model_object.class.name @lambda_arn = [:lambda_arn].presence @region = [:region].presence || TreatanyoneCommonApi::Kinesis::DEFAULT_REGION end |
Instance Attribute Details
#aggregate_type ⇒ Object (readonly)
Returns the value of attribute aggregate_type.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def aggregate_type @aggregate_type end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def data @data end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def event_type @event_type end |
#lambda_arn ⇒ Object (readonly)
Returns the value of attribute lambda_arn.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def lambda_arn @lambda_arn end |
#model_object ⇒ Object (readonly)
Returns the value of attribute model_object.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def model_object @model_object end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def region @region end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
10 11 12 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 10 def user_id @user_id end |
Instance Method Details
#publish_event ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/treatanyone_common_api/kinesis.rb', line 23 def publish_event client.put_record( stream_name: kinesis_stream_name, data: event_data_as_json, partition_key: partition_key ) end |