Sha256: c860e0e67b462ee90597c52186146e9bdd1c7ca4f437ece51b18448fd39d8824

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

require "ostruct"

module Rancher
  module ManagementApi
    class Project < OpenStruct
      def self.create(conn, name)
        env_response = conn.post do |req|
          req.url "/v1/project"
          req.body = {
            name: name,
          }.to_json
        end

        data = JSON.parse(env_response.body)

        new(conn, data)
      end

      attr_reader :conn

      def initialize(conn, data)
        @conn = conn
        super(data)
      end

      def create_api_key(name)
        ApiKey.create(self, name)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rancher-management_api-0.2.0 lib/rancher/management_api/project.rb
rancher-management_api-0.1.1 lib/rancher/management_api/project.rb
rancher-management_api-0.1.0 lib/rancher/management_api/project.rb