Class: Openlayer::Resources::Projects

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/projects.rb,
lib/openlayer/resources/projects/tests.rb,
lib/openlayer/resources/projects/commits.rb,
lib/openlayer/resources/projects/inference_pipelines.rb,
sig/openlayer/resources/projects.rbs,
sig/openlayer/resources/projects/tests.rbs,
sig/openlayer/resources/projects/commits.rbs,
sig/openlayer/resources/projects/inference_pipelines.rbs

Defined Under Namespace

Classes: Commits, InferencePipelines, Tests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Projects

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Projects.

Parameters:



141
142
143
144
145
146
# File 'lib/openlayer/resources/projects.rb', line 141

def initialize(client:)
  @client = client
  @commits = Openlayer::Resources::Projects::Commits.new(client: client)
  @inference_pipelines = Openlayer::Resources::Projects::InferencePipelines.new(client: client)
  @tests = Openlayer::Resources::Projects::Tests.new(client: client)
end

Instance Attribute Details

#commitsOpenlayer::Resources::Projects::Commits (readonly)



7
8
9
# File 'lib/openlayer/resources/projects.rb', line 7

def commits
  @commits
end

#inference_pipelinesOpenlayer::Resources::Projects::InferencePipelines (readonly)



10
11
12
# File 'lib/openlayer/resources/projects.rb', line 10

def inference_pipelines
  @inference_pipelines
end

#testsOpenlayer::Resources::Projects::Tests (readonly)



13
14
15
# File 'lib/openlayer/resources/projects.rb', line 13

def tests
  @tests
end

Instance Method Details

#create(name:, task_type:, data_retention_days: nil, description: nil, model_developer: nil, model_types: nil, purpose: nil, request_options: {}) ⇒ Openlayer::Models::ProjectCreateResponse

Some parameter documentations has been truncated, see Models::ProjectCreateParams for more details.

Create a project in your workspace.

Parameters:

  • name (String)

    The project name.

  • task_type (Symbol, Openlayer::Models::ProjectCreateParams::TaskType)

    The task type of the project.

  • data_retention_days (Integer, nil)

    Number of days to retain monitoring data for this project. Null means data is re

  • description (String, nil)

    The project description.

  • model_developer (String, nil)

    Who developed the model used in this project.

  • model_types (Array<String>, nil)

    The kinds of model used in this project.

  • purpose (String, nil)

    What the system in this project is intended to do.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
# File 'lib/openlayer/resources/projects.rb', line 41

def create(params)
  parsed, options = Openlayer::ProjectCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "projects",
    body: parsed,
    model: Openlayer::Models::ProjectCreateResponse,
    options: options
  )
end

#delete(project_id, request_options: {}) ⇒ nil

Delete a project by its ID.

Parameters:

Returns:

  • (nil)

See Also:



129
130
131
132
133
134
135
136
# File 'lib/openlayer/resources/projects.rb', line 129

def delete(project_id, params = {})
  @client.request(
    method: :delete,
    path: ["projects/%1$s", project_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(name: nil, page: nil, per_page: nil, task_type: nil, request_options: {}) ⇒ Openlayer::Models::ProjectListResponse

List your workspace's projects.

Parameters:

  • name (String)

    Filter list of items by project name.

  • page (Integer)

    The page to return in a paginated query.

  • per_page (Integer)

    Maximum number of items to return per page.

  • task_type (Symbol, Openlayer::Models::ProjectListParams::TaskType)

    Filter list of items by task type.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/openlayer/resources/projects.rb', line 106

def list(params = {})
  parsed, options = Openlayer::ProjectListParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "projects",
    query: query.transform_keys(per_page: "perPage", task_type: "taskType"),
    model: Openlayer::Models::ProjectListResponse,
    options: options
  )
end

#update(project_id, data_retention_days: nil, description: nil, model_developer: nil, model_types: nil, name: nil, purpose: nil, request_options: {}) ⇒ Openlayer::Models::ProjectUpdateResponse

Some parameter documentations has been truncated, see Models::ProjectUpdateParams for more details.

Update a project's metadata.

Parameters:

  • project_id (String)

    The project id.

  • data_retention_days (Integer, nil)

    Number of days to retain monitoring data for this project. Null means data is re

  • description (String, nil)

    The project description.

  • model_developer (String, nil)

    Who developed the model used in this project.

  • model_types (Array<String>, nil)

    The kinds of model used in this project.

  • name (String)

    The project name.

  • purpose (String, nil)

    What the system in this project is intended to do.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
# File 'lib/openlayer/resources/projects.rb', line 78

def update(project_id, params = {})
  parsed, options = Openlayer::ProjectUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["projects/%1$s", project_id],
    body: parsed,
    model: Openlayer::Models::ProjectUpdateResponse,
    options: options
  )
end