Module: Google::Cloud::Talent::V4beta1::JobService::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/talent/v4beta1/job_service/paths.rb

Overview

Path helper methods for the JobService API.

Instance Method Summary collapse

Instance Method Details

#company_path(project: , tenant: , company: ) ⇒ ::String #company_path(project: , company: ) ⇒ ::String

Create a fully-qualified Company resource string.

Overloads:

  • #company_path(project: , tenant: , company: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/tenants/{tenant}/companies/{company}

    Parameters:

    • project (String) (defaults to: )
    • tenant (String) (defaults to: )
    • company (String) (defaults to: )
  • #company_path(project: , company: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/companies/{company}

    Parameters:

    • project (String) (defaults to: )
    • company (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/google/cloud/talent/v4beta1/job_service/paths.rb', line 48

def company_path **args
  resources = {
    "company:project:tenant" => (proc do |project:, tenant:, company:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "tenant cannot contain /" if tenant.to_s.include? "/"

      "projects/#{project}/tenants/#{tenant}/companies/#{company}"
    end),
    "company:project" => (proc do |project:, company:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/companies/#{company}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#job_path(project: , tenant: , job: ) ⇒ ::String #job_path(project: , job: ) ⇒ ::String

Create a fully-qualified Job resource string.

Overloads:

  • #job_path(project: , tenant: , job: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/tenants/{tenant}/jobs/{job}

    Parameters:

    • project (String) (defaults to: )
    • tenant (String) (defaults to: )
    • job (String) (defaults to: )
  • #job_path(project: , job: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/jobs/{job}

    Parameters:

    • project (String) (defaults to: )
    • job (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/google/cloud/talent/v4beta1/job_service/paths.rb', line 89

def job_path **args
  resources = {
    "job:project:tenant" => (proc do |project:, tenant:, job:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "tenant cannot contain /" if tenant.to_s.include? "/"

      "projects/#{project}/tenants/#{tenant}/jobs/#{job}"
    end),
    "job:project" => (proc do |project:, job:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/jobs/#{job}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


119
120
121
# File 'lib/google/cloud/talent/v4beta1/job_service/paths.rb', line 119

def project_path project:
  "projects/#{project}"
end

#tenant_path(project:, tenant:) ⇒ ::String

Create a fully-qualified Tenant resource string.

The resource will be in the following format:

projects/{project}/tenants/{tenant}

Parameters:

  • project (String)
  • tenant (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


134
135
136
137
138
# File 'lib/google/cloud/talent/v4beta1/job_service/paths.rb', line 134

def tenant_path project:, tenant:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/tenants/#{tenant}"
end