Class: GetMocksMockIDResponseMock

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



11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
# File 'lib/schemas.rb', line 11203

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

.from_json!(json) ⇒ Object



11221
11222
11223
# File 'lib/schemas.rb', line 11221

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

Instance Method Details

#to_dynamicObject



11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
# File 'lib/schemas.rb', line 11225

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

#to_json(options = nil) ⇒ Object



11242
11243
11244
# File 'lib/schemas.rb', line 11242

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