Module: Google::Cloud::Talent::V4beta1::ApplicationService::Paths

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

Overview

Path helper methods for the ApplicationService API.

Instance Method Summary collapse

Instance Method Details

#application_path(project:, tenant:, profile:, application:) ⇒ ::String

Create a fully-qualified Application resource string.

The resource will be in the following format:

projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}

Parameters:

  • project (String)
  • tenant (String)
  • profile (String)
  • application (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


40
41
42
43
44
45
46
# File 'lib/google/cloud/talent/v4beta1/application_service/paths.rb', line 40

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

  "projects/#{project}/tenants/#{tenant}/profiles/#{profile}/applications/#{application}"
end

#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)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/google/cloud/talent/v4beta1/application_service/paths.rb', line 69

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)


110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/google/cloud/talent/v4beta1/application_service/paths.rb', line 110

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

#profile_path(project:, tenant:, profile:) ⇒ ::String

Create a fully-qualified Profile resource string.

The resource will be in the following format:

projects/{project}/tenants/{tenant}/profiles/{profile}

Parameters:

  • project (String)
  • tenant (String)
  • profile (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


142
143
144
145
146
147
# File 'lib/google/cloud/talent/v4beta1/application_service/paths.rb', line 142

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

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