Class: Cadenya::Types::ObjectiveEvent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata: nil, data: nil, context_window_id: nil, info: nil, duration: nil, started_at: nil) ⇒ ObjectiveEvent

Returns a new instance of ObjectiveEvent.



3745
3746
3747
3748
3749
3750
3751
3752
# File 'lib/cadenya/types.rb', line 3745

def initialize(metadata: nil, data: nil, context_window_id: nil, info: nil, duration: nil, started_at: nil)
  @metadata = 
  @data = data
  @context_window_id = context_window_id
  @info = info
  @duration = duration
  @started_at = started_at
end

Instance Attribute Details

#context_window_idObject (readonly)

Returns the value of attribute context_window_id.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def context_window_id
  @context_window_id
end

#dataObject (readonly)

Returns the value of attribute data.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def data
  @data
end

#durationObject (readonly)

Returns the value of attribute duration.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def duration
  @duration
end

#infoObject (readonly)

Returns the value of attribute info.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def 
  @metadata
end

#started_atObject (readonly)

Returns the value of attribute started_at.



3743
3744
3745
# File 'lib/cadenya/types.rb', line 3743

def started_at
  @started_at
end

Class Method Details

.from_json(data) ⇒ Object



3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
# File 'lib/cadenya/types.rb', line 3754

def self.from_json(data)
  new(
    metadata: data["metadata"].nil? ? nil : Types::OperationMetadata.from_json(data["metadata"]),
    data: data["data"].nil? ? nil : Types.decode_ObjectiveEventData(data["data"]),
    context_window_id: data["contextWindowId"],
    info: data["info"].nil? ? nil : Types::ObjectiveEventInfo.from_json(data["info"]),
    duration: data["duration"],
    started_at: data["startedAt"].nil? ? nil : Time.iso8601(data["startedAt"]),
  )
end

Instance Method Details

#to_hObject



3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
# File 'lib/cadenya/types.rb', line 3765

def to_h
  {
    metadata: Util.plain(@metadata),
    data: Util.plain(@data),
    context_window_id: Util.plain(@context_window_id),
    info: Util.plain(@info),
    duration: Util.plain(@duration),
    started_at: Util.plain(@started_at),
  }.reject { |_k, v| v.nil? }
end