Class: DeleteMocksMockIDServerResponsesServerResponseIDResponse

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



2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
# File 'lib/schemas.rb', line 2570

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    body:                                                                   d["body"],
    created_at:                                                             d["createdAt"],
    created_by:                                                             d["createdBy"],
    headers:                                                                d["headers"]&.map { |x| DeleteMocksMockIDServerResponsesServerResponseIDResponseHeadersItem.from_dynamic!(x) },
    id:                                                                     d["id"],
    language:                                                               d["language"],
    delete_mocks_mock_id_server_responses_server_response_id_response_name: d["name"],
    status_code:                                                            d["statusCode"],
    updated_by:                                                             d["updatedBy"],
  )
end

.from_json!(json) ⇒ Object



2585
2586
2587
# File 'lib/schemas.rb', line 2585

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

Instance Method Details

#to_dynamicObject



2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
# File 'lib/schemas.rb', line 2589

def to_dynamic
  {
    "body"       => body,
    "createdAt"  => created_at,
    "createdBy"  => created_by,
    "headers"    => headers&.map { |x| x.to_dynamic },
    "id"         => id,
    "language"   => language,
    "name"       => delete_mocks_mock_id_server_responses_server_response_id_response_name,
    "statusCode" => status_code,
    "updatedBy"  => updated_by,
  }
end

#to_json(options = nil) ⇒ Object



2603
2604
2605
# File 'lib/schemas.rb', line 2603

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