Class: ConnectClient::Client
- Inherits:
-
Object
- Object
- ConnectClient::Client
- Defined in:
- lib/connect_client/client.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #push(collection_name_or_batches, event_or_events = nil) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
7 8 9 |
# File 'lib/connect_client/client.rb', line 7 def initialize(config) @end_point = ConnectClient::Http::EventEndpoint.new config end |
Instance Method Details
#push(collection_name_or_batches, event_or_events = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/connect_client/client.rb', line 11 def push(collection_name_or_batches, event_or_events = nil) has_multiple_events = event_or_events.is_a?(Array) has_collection_name = collection_name_or_batches.is_a?(String) || collection_name_or_batches.is_a?(Symbol) is_batch = !has_collection_name || has_multiple_events if is_batch batch = create_batch(has_collection_name, collection_name_or_batches, event_or_events) @end_point.push_batch batch else @end_point.push(collection_name_or_batches, ConnectClient::Event.new(event_or_events)) end end |