Class: PutMocksMockIDResponseMock

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



32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
# File 'lib/schemas.rb', line 32587

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    collection:                           d["collection"],
    config:                               d["config"] ? PutMocksMockIDResponseMockConfig.from_dynamic!(d["config"]) : nil,
    created_at:                           d["createdAt"],
    environment:                          d["environment"],
    id:                                   d["id"],
    mock_url:                             d["mockUrl"],
    put_mocks_mock_id_response_mock_name: d["name"],
    owner:                                d["owner"],
    uid:                                  d["uid"],
    updated_at:                           d["updatedAt"],
  )
end

.from_json!(json) ⇒ Object



32603
32604
32605
# File 'lib/schemas.rb', line 32603

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

Instance Method Details

#to_dynamicObject



32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
# File 'lib/schemas.rb', line 32607

def to_dynamic
  {
    "collection"  => collection,
    "config"      => config&.to_dynamic,
    "createdAt"   => created_at,
    "environment" => environment,
    "id"          => id,
    "mockUrl"     => mock_url,
    "name"        => put_mocks_mock_id_response_mock_name,
    "owner"       => owner,
    "uid"         => uid,
    "updatedAt"   => updated_at,
  }
end

#to_json(options = nil) ⇒ Object



32622
32623
32624
# File 'lib/schemas.rb', line 32622

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