Class: GetMocksResponseMocksItem

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



12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
# File 'lib/schemas.rb', line 12209

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

.from_json!(json) ⇒ Object



12226
12227
12228
# File 'lib/schemas.rb', line 12226

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

Instance Method Details

#to_dynamicObject



12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
# File 'lib/schemas.rb', line 12230

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

#to_json(options = nil) ⇒ Object



12246
12247
12248
# File 'lib/schemas.rb', line 12246

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