Class: Cadenya::Types::ObjectiveEventWebhookData

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(type: nil, timestamp: nil, data: nil) ⇒ ObjectiveEventWebhookData

Returns a new instance of ObjectiveEventWebhookData.



7705
7706
7707
7708
7709
# File 'lib/cadenya/types.rb', line 7705

def initialize(type: nil, timestamp: nil, data: nil)
  @type = type
  @timestamp = timestamp
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7703
7704
7705
# File 'lib/cadenya/types.rb', line 7703

def data
  @data
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



7703
7704
7705
# File 'lib/cadenya/types.rb', line 7703

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



7703
7704
7705
# File 'lib/cadenya/types.rb', line 7703

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



7711
7712
7713
7714
7715
7716
7717
# File 'lib/cadenya/types.rb', line 7711

def self.from_json(data)
  new(
    type: data["type"],
    timestamp: data["timestamp"].nil? ? nil : Time.iso8601(data["timestamp"]),
    data: data["data"].nil? ? nil : Types::ObjectiveEventWebhookDataData.from_json(data["data"]),
  )
end

Instance Method Details

#to_hObject



7719
7720
7721
7722
7723
7724
7725
# File 'lib/cadenya/types.rb', line 7719

def to_h
  {
    type: Util.plain(@type),
    timestamp: Util.plain(@timestamp),
    data: Util.plain(@data),
  }.reject { |_k, v| v.nil? }
end