Class: ProjectsCommand

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Overview

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier

Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data

Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization

Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data

Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones

Returns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
# File 'lib/schemas.rb', line 1001

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    get:    d["get"] ? ProjectGetRequest.from_dynamic!(d["get"]) : nil,
    create: d["create"] ? ProjectCreateRequest.from_dynamic!(d["create"]) : nil,
    list:   d["list"] ? ProjectsListRequest.from_dynamic!(d["list"]) : nil,
    update: d["update"] ? ProjectPutRequest.from_dynamic!(d["update"]) : nil,
    delete: d["delete"] ? ProjectsDeleteRequest.from_dynamic!(d["delete"]) : nil,
  )
end

.from_json!(json) ⇒ Object



1012
1013
1014
# File 'lib/schemas.rb', line 1012

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

Instance Method Details

#to_dynamicObject



1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/schemas.rb', line 1016

def to_dynamic
  {
    "get"    => get&.to_dynamic,
    "create" => create&.to_dynamic,
    "list"   => list&.to_dynamic,
    "update" => update&.to_dynamic,
    "delete" => delete&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



1026
1027
1028
# File 'lib/schemas.rb', line 1026

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