Class: Intrinsic::ListEventTypesResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/intrinsic/types/list_event_types_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, object:, additional_properties: nil) ⇒ ListEventTypesResponse

Parameters:

  • data (Array<EventTypeObject>)
  • object (String)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



14
15
16
17
18
19
20
21
# File 'lib/intrinsic/types/list_event_types_response.rb', line 14

def initialize(data:, object:, additional_properties: nil)
  # @type [Array<EventTypeObject>]
  @data = data
  # @type [String]
  @object = object
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



8
9
10
# File 'lib/intrinsic/types/list_event_types_response.rb', line 8

def additional_properties
  @additional_properties
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/intrinsic/types/list_event_types_response.rb', line 8

def data
  @data
end

#objectObject (readonly)

Returns the value of attribute object.



8
9
10
# File 'lib/intrinsic/types/list_event_types_response.rb', line 8

def object
  @object
end

Class Method Details

.from_json(json_object:) ⇒ ListEventTypesResponse

Deserialize a JSON object to an instance of ListEventTypesResponse

Parameters:

  • json_object (JSON)

Returns:



27
28
29
30
31
32
33
34
35
36
# File 'lib/intrinsic/types/list_event_types_response.rb', line 27

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  data = parsed_json["data"]&.map do |v|
    v = v.to_json
    EventTypeObject.from_json(json_object: v)
  end
  object = struct.object
  new(data: data, object: object, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


49
50
51
52
# File 'lib/intrinsic/types/list_event_types_response.rb', line 49

def self.validate_raw(obj:)
  obj.data.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
  obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of ListEventTypesResponse to a JSON object

Returns:

  • (JSON)


41
42
43
# File 'lib/intrinsic/types/list_event_types_response.rb', line 41

def to_json(*_args)
  { "data": @data, "object": @object }.to_json
end