Class: GetMocksMockIDCallLogsResponseCallLogsItem

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
# File 'lib/schemas.rb', line 10766

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:            d["id"],
    request:       d["request"] ? GetMocksMockIDCallLogsResponseCallLogsItemRequest.from_dynamic!(d["request"]) : nil,
    response:      d["response"] ? GetMocksMockIDCallLogsResponseCallLogsItemResponse.from_dynamic!(d["response"]) : nil,
    response_name: d["responseName"],
    served_at:     d["servedAt"],
  )
end

.from_json!(json) ⇒ Object



10777
10778
10779
# File 'lib/schemas.rb', line 10777

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



10781
10782
10783
10784
10785
10786
10787
10788
10789
# File 'lib/schemas.rb', line 10781

def to_dynamic
  {
    "id"           => id,
    "request"      => request&.to_dynamic,
    "response"     => response&.to_dynamic,
    "responseName" => response_name,
    "servedAt"     => served_at,
  }
end

#to_json(options = nil) ⇒ Object



10791
10792
10793
# File 'lib/schemas.rb', line 10791

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end