Class: PostMocksMockIDServerResponsesResponseItem

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



24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
# File 'lib/schemas.rb', line 24523

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    created_at:                                             d["createdAt"],
    created_by:                                             d["createdBy"],
    id:                                                     d["id"],
    post_mocks_mock_id_server_responses_response_item_name: d["name"],
    status_code:                                            d["statusCode"],
    updated_at:                                             d["updatedAt"],
    updated_by:                                             d["updatedBy"],
  )
end

.from_json!(json) ⇒ Object



24536
24537
24538
# File 'lib/schemas.rb', line 24536

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

Instance Method Details

#to_dynamicObject



24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
# File 'lib/schemas.rb', line 24540

def to_dynamic
  {
    "createdAt"  => created_at,
    "createdBy"  => created_by,
    "id"         => id,
    "name"       => post_mocks_mock_id_server_responses_response_item_name,
    "statusCode" => status_code,
    "updatedAt"  => updated_at,
    "updatedBy"  => updated_by,
  }
end

#to_json(options = nil) ⇒ Object



24552
24553
24554
# File 'lib/schemas.rb', line 24552

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