Class: ApiReference::IngestEvent
- Defined in:
- lib/api_reference/models/ingest_event.rb
Overview
IngestEvent Model.
Instance Attribute Summary collapse
-
#customer_id ⇒ String
The Orb Customer identifier.
-
#event_name ⇒ String
A name to meaningfully identify the action or event type.
-
#external_customer_id ⇒ String
An alias for the Orb customer, whose mapping is specified when creating the customer.
-
#idempotency_key ⇒ String
A unique value, generated by the client, that is used to de-duplicate events.
-
#properties ⇒ Object
A dictionary of custom properties.
-
#timestamp ⇒ DateTime
An ISO 8601 format date with no timezone offset (i.e. UTC).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(event_name:, timestamp:, properties:, idempotency_key:, customer_id: SKIP, external_customer_id: SKIP) ⇒ IngestEvent
constructor
A new instance of IngestEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(event_name:, timestamp:, properties:, idempotency_key:, customer_id: SKIP, external_customer_id: SKIP) ⇒ IngestEvent
Returns a new instance of IngestEvent.
71 72 73 74 75 76 77 78 79 |
# File 'lib/api_reference/models/ingest_event.rb', line 71 def initialize(event_name:, timestamp:, properties:, idempotency_key:, customer_id: SKIP, external_customer_id: SKIP) @customer_id = customer_id unless customer_id == SKIP @external_customer_id = external_customer_id unless external_customer_id == SKIP @event_name = event_name @timestamp = @properties = properties @idempotency_key = idempotency_key end |
Instance Attribute Details
#customer_id ⇒ String
The Orb Customer identifier
15 16 17 |
# File 'lib/api_reference/models/ingest_event.rb', line 15 def customer_id @customer_id end |
#event_name ⇒ String
A name to meaningfully identify the action or event type.
24 25 26 |
# File 'lib/api_reference/models/ingest_event.rb', line 24 def event_name @event_name end |
#external_customer_id ⇒ String
An alias for the Orb customer, whose mapping is specified when creating the customer
20 21 22 |
# File 'lib/api_reference/models/ingest_event.rb', line 20 def external_customer_id @external_customer_id end |
#idempotency_key ⇒ String
A unique value, generated by the client, that is used to de-duplicate events. Exactly one event with a given idempotency key will be ingested, which allows for safe request retries.
41 42 43 |
# File 'lib/api_reference/models/ingest_event.rb', line 41 def idempotency_key @idempotency_key end |
#properties ⇒ Object
A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or strings. Nested dictionaries are disallowed.
35 36 37 |
# File 'lib/api_reference/models/ingest_event.rb', line 35 def properties @properties end |
#timestamp ⇒ DateTime
An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the time that usage was recorded, and is particularly important to attribute usage to a given billing period.
30 31 32 |
# File 'lib/api_reference/models/ingest_event.rb', line 30 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/api_reference/models/ingest_event.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. event_name = hash.key?('event_name') ? hash['event_name'] : nil = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end properties = hash.key?('properties') ? hash['properties'] : nil idempotency_key = hash.key?('idempotency_key') ? hash['idempotency_key'] : nil customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP external_customer_id = hash.key?('external_customer_id') ? hash['external_customer_id'] : SKIP # Create object from extracted values. IngestEvent.new(event_name: event_name, timestamp: , properties: properties, idempotency_key: idempotency_key, customer_id: customer_id, external_customer_id: external_customer_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/api_reference/models/ingest_event.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['customer_id'] = 'customer_id' @_hash['external_customer_id'] = 'external_customer_id' @_hash['event_name'] = 'event_name' @_hash['timestamp'] = 'timestamp' @_hash['properties'] = 'properties' @_hash['idempotency_key'] = 'idempotency_key' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 67 68 69 |
# File 'lib/api_reference/models/ingest_event.rb', line 64 def self.nullables %w[ customer_id external_customer_id ] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 |
# File 'lib/api_reference/models/ingest_event.rb', line 56 def self.optionals %w[ customer_id external_customer_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 125 |
# File 'lib/api_reference/models/ingest_event.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} customer_id: #{@customer_id.inspect}, external_customer_id:"\ " #{@external_customer_id.inspect}, event_name: #{@event_name.inspect}, timestamp:"\ " #{@timestamp.inspect}, properties: #{@properties.inspect}, idempotency_key:"\ " #{@idempotency_key.inspect}>" end |
#to_custom_timestamp ⇒ Object
106 107 108 |
# File 'lib/api_reference/models/ingest_event.rb', line 106 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/api_reference/models/ingest_event.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} customer_id: #{@customer_id}, external_customer_id:"\ " #{@external_customer_id}, event_name: #{@event_name}, timestamp: #{@timestamp},"\ " properties: #{@properties}, idempotency_key: #{@idempotency_key}>" end |