Class: ApiReference::AmendedEvent
- Defined in:
- lib/api_reference/models/amended_event.rb
Overview
AmendedEvent 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.
-
#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:, customer_id: SKIP, external_customer_id: SKIP) ⇒ AmendedEvent
constructor
A new instance of AmendedEvent.
-
#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:, customer_id: SKIP, external_customer_id: SKIP) ⇒ AmendedEvent
Returns a new instance of AmendedEvent.
64 65 66 67 68 69 70 71 |
# File 'lib/api_reference/models/amended_event.rb', line 64 def initialize(event_name:, timestamp:, properties:, 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 end |
Instance Attribute Details
#customer_id ⇒ String
The Orb Customer identifier
15 16 17 |
# File 'lib/api_reference/models/amended_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/amended_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/amended_event.rb', line 20 def external_customer_id @external_customer_id 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/amended_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/amended_event.rb', line 30 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/api_reference/models/amended_event.rb', line 74 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 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. AmendedEvent.new(event_name: event_name, timestamp: , properties: properties, customer_id: customer_id, external_customer_id: external_customer_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 |
# File 'lib/api_reference/models/amended_event.rb', line 38 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 end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 60 61 62 |
# File 'lib/api_reference/models/amended_event.rb', line 57 def self.nullables %w[ customer_id external_customer_id ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 |
# File 'lib/api_reference/models/amended_event.rb', line 49 def self.optionals %w[ customer_id external_customer_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
108 109 110 111 112 113 |
# File 'lib/api_reference/models/amended_event.rb', line 108 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}>" end |
#to_custom_timestamp ⇒ Object
95 96 97 |
# File 'lib/api_reference/models/amended_event.rb', line 95 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
100 101 102 103 104 105 |
# File 'lib/api_reference/models/amended_event.rb', line 100 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}>" end |