Class: GetWorkspacesWorkspaceIDResponseWorkspace

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



17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
# File 'lib/schemas.rb', line 17203

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    apis:                                                d["apis"]&.map { |x| GetWorkspacesWorkspaceIDResponseWorkspaceApisItem.from_dynamic!(x) },
    collections:                                         d["collections"]&.map { |x| GetWorkspacesWorkspaceIDResponseWorkspaceCollectionsItem.from_dynamic!(x) },
    created_at:                                          d["createdAt"],
    created_by:                                          d["createdBy"],
    description:                                         d["description"],
    environments:                                        d["environments"]&.map { |x| GetWorkspacesWorkspaceIDResponseWorkspaceEnvironmentsItem.from_dynamic!(x) },
    id:                                                  d["id"],
    mocks:                                               d["mocks"]&.map { |x| GetWorkspacesWorkspaceIDResponseWorkspaceMocksItem.from_dynamic!(x) },
    monitors:                                            d["monitors"]&.map { |x| GetWorkspacesWorkspaceIDResponseWorkspaceMonitorsItem.from_dynamic!(x) },
    get_workspaces_workspace_id_response_workspace_name: d["name"],
    get_workspaces_workspace_id_response_workspace_type: d["type"],
    updated_at:                                          d["updatedAt"],
    updated_by:                                          d["updatedBy"],
    visibility:                                          d["visibility"],
  )
end

.from_json!(json) ⇒ Object



17223
17224
17225
# File 'lib/schemas.rb', line 17223

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

Instance Method Details

#to_dynamicObject



17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
# File 'lib/schemas.rb', line 17227

def to_dynamic
  {
    "apis"         => apis&.map { |x| x.to_dynamic },
    "collections"  => collections&.map { |x| x.to_dynamic },
    "createdAt"    => created_at,
    "createdBy"    => created_by,
    "description"  => description,
    "environments" => environments&.map { |x| x.to_dynamic },
    "id"           => id,
    "mocks"        => mocks&.map { |x| x.to_dynamic },
    "monitors"     => monitors&.map { |x| x.to_dynamic },
    "name"         => get_workspaces_workspace_id_response_workspace_name,
    "type"         => get_workspaces_workspace_id_response_workspace_type,
    "updatedAt"    => updated_at,
    "updatedBy"    => updated_by,
    "visibility"   => visibility,
  }
end

#to_json(options = nil) ⇒ Object



17246
17247
17248
# File 'lib/schemas.rb', line 17246

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