Class: Gusto::Event
- Inherits:
-
Object
- Object
- Gusto::Event
- Defined in:
- lib/fern_gusto/types/event.rb
Overview
Representation of an Event
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#entity_type ⇒ String
readonly
Name of the entity that the event corresponds to.
-
#entity_uuid ⇒ String
readonly
Unique identifier for the entity.
-
#event_type ⇒ String
readonly
Description of the event (e.g., payroll.submitted, or company.form.signed).
-
#resource_type ⇒ String
readonly
Name of the parent resource of the described entity.
-
#resource_uuid ⇒ String
readonly
Unique identifier for the parent resource.
-
#timestamp ⇒ Integer
readonly
Time at which this event was created.
-
#uuid ⇒ String
readonly
Unique identifier for the event.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, event_type: OMIT, resource_type: OMIT, resource_uuid: OMIT, entity_type: OMIT, entity_uuid: OMIT, timestamp: OMIT, additional_properties: nil) ⇒ Gusto::Event constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, event_type: OMIT, resource_type: OMIT, resource_uuid: OMIT, entity_type: OMIT, entity_uuid: OMIT, timestamp: OMIT, additional_properties: nil) ⇒ Gusto::Event
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fern_gusto/types/event.rb', line 39 def initialize(uuid:, event_type: OMIT, resource_type: OMIT, resource_uuid: OMIT, entity_type: OMIT, entity_uuid: OMIT, timestamp: OMIT, additional_properties: nil) @uuid = uuid @event_type = event_type if event_type != OMIT @resource_type = resource_type if resource_type != OMIT @resource_uuid = resource_uuid if resource_uuid != OMIT @entity_type = entity_type if entity_type != OMIT @entity_uuid = entity_uuid if entity_uuid != OMIT @timestamp = if != OMIT @additional_properties = additional_properties @_field_set = { "uuid": uuid, "event_type": event_type, "resource_type": resource_type, "resource_uuid": resource_uuid, "entity_type": entity_type, "entity_uuid": entity_uuid, "timestamp": }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/fern_gusto/types/event.rb', line 23 def additional_properties @additional_properties end |
#entity_type ⇒ String (readonly)
Returns Name of the entity that the event corresponds to.
17 18 19 |
# File 'lib/fern_gusto/types/event.rb', line 17 def entity_type @entity_type end |
#entity_uuid ⇒ String (readonly)
Returns Unique identifier for the entity.
19 20 21 |
# File 'lib/fern_gusto/types/event.rb', line 19 def entity_uuid @entity_uuid end |
#event_type ⇒ String (readonly)
Returns Description of the event (e.g., payroll.submitted, or company.form.signed).
11 12 13 |
# File 'lib/fern_gusto/types/event.rb', line 11 def event_type @event_type end |
#resource_type ⇒ String (readonly)
Returns Name of the parent resource of the described entity.
13 14 15 |
# File 'lib/fern_gusto/types/event.rb', line 13 def resource_type @resource_type end |
#resource_uuid ⇒ String (readonly)
Returns Unique identifier for the parent resource.
15 16 17 |
# File 'lib/fern_gusto/types/event.rb', line 15 def resource_uuid @resource_uuid end |
#timestamp ⇒ Integer (readonly)
Returns Time at which this event was created. Measured in seconds since the Unix epoch.
21 22 23 |
# File 'lib/fern_gusto/types/event.rb', line 21 def @timestamp end |
#uuid ⇒ String (readonly)
Returns Unique identifier for the event.
9 10 11 |
# File 'lib/fern_gusto/types/event.rb', line 9 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Event
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fern_gusto/types/event.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] event_type = parsed_json["event_type"] resource_type = parsed_json["resource_type"] resource_uuid = parsed_json["resource_uuid"] entity_type = parsed_json["entity_type"] entity_uuid = parsed_json["entity_uuid"] = parsed_json["timestamp"] new( uuid: uuid, event_type: event_type, resource_type: resource_type, resource_uuid: resource_uuid, entity_type: entity_type, entity_uuid: entity_uuid, timestamp: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
89 90 91 92 93 94 95 96 97 |
# File 'lib/fern_gusto/types/event.rb', line 89 def self.validate_raw(obj:) obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") obj.event_type&.is_a?(String) != false || raise("Passed value for field obj.event_type is not the expected type, validation failed.") obj.resource_type&.is_a?(String) != false || raise("Passed value for field obj.resource_type is not the expected type, validation failed.") obj.resource_uuid&.is_a?(String) != false || raise("Passed value for field obj.resource_uuid is not the expected type, validation failed.") obj.entity_type&.is_a?(String) != false || raise("Passed value for field obj.entity_type is not the expected type, validation failed.") obj.entity_uuid&.is_a?(String) != false || raise("Passed value for field obj.entity_uuid is not the expected type, validation failed.") obj.&.is_a?(Integer) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
80 81 82 |
# File 'lib/fern_gusto/types/event.rb', line 80 def to_json @_field_set&.to_json end |