Class: Google::Cloud::Talent::V4beta1::CompanyServiceClient
- Inherits:
-
Object
- Object
- Google::Cloud::Talent::V4beta1::CompanyServiceClient
- Defined in:
- lib/google/cloud/talent/v4beta1/company_service_client.rb,
lib/google/cloud/talent/v4beta1/helpers.rb
Overview
A service that handles company management, including CRUD and enumeration.
Constant Summary collapse
- SERVICE_ADDRESS =
The default address of the service.
"jobs.googleapis.com".freeze
- DEFAULT_SERVICE_PORT =
The default port of the service.
443
- GRPC_INTERCEPTORS =
The default set of gRPC interceptors.
[]
- DEFAULT_TIMEOUT =
30
- ALL_SCOPES =
The scopes needed to make gRPC calls to all of the methods defined in this service.
[ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/jobs" ].freeze
Class Method Summary collapse
-
.company_path(project, tenant, company) ⇒ String
Returns a fully-qualified company resource name string.
-
.company_without_tenant_path(project, company) ⇒ String
Returns a fully-qualified company_without_tenant resource name string.
-
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
-
.tenant_path(project, tenant) ⇒ String
Returns a fully-qualified tenant resource name string.
Instance Method Summary collapse
-
#company_path(project, tenant, company) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_path.
-
#company_without_tenant_path(project, company) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_without_tenant_path.
-
#create_company(parent, company, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Creates a new company entity.
-
#delete_company(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes specified company.
-
#get_company(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Retrieves specified company.
-
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ CompanyServiceClient
constructor
A new instance of CompanyServiceClient.
-
#list_companies(parent, page_size: nil, require_open_jobs: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Company>
Lists all companies associated with the project.
-
#project_path(project) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.project_path.
-
#tenant_path(project, tenant) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.tenant_path.
-
#update_company(company, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Updates specified company.
Constructor Details
#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ CompanyServiceClient
Returns a new instance of CompanyServiceClient.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 173 def initialize \ credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "" # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "google/gax/grpc" require "google/cloud/talent/v4beta1/company_service_services_pb" credentials ||= Google::Cloud::Talent::V4beta1::Credentials.default if credentials.is_a?(String) || credentials.is_a?(Hash) updater_proc = Google::Cloud::Talent::V4beta1::Credentials.new(credentials).updater_proc end if credentials.is_a?(GRPC::Core::Channel) channel = credentials end if credentials.is_a?(GRPC::Core::ChannelCredentials) chan_creds = credentials end if credentials.is_a?(Proc) updater_proc = credentials end if credentials.is_a?(Google::Auth::Credentials) updater_proc = credentials.updater_proc end package_version = Google::Cloud::Talent::VERSION google_api_client = "gl-ruby/#{RUBY_VERSION}" google_api_client << " #{lib_name}/#{lib_version}" if lib_name google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}" google_api_client << " grpc/#{GRPC::VERSION}" google_api_client.freeze headers = { :"x-goog-api-client" => google_api_client } headers.merge!() unless .nil? client_config_file = Pathname.new(__dir__).join( "company_service_client_config.json" ) defaults = client_config_file.open do |f| Google::Gax.construct_settings( "google.cloud.talent.v4beta1.CompanyService", JSON.parse(f.read), client_config, Google::Gax::Grpc::STATUS_CODE_NAMES, timeout, page_descriptors: PAGE_DESCRIPTORS, errors: Google::Gax::Grpc::API_ERRORS, metadata: headers ) end # Allow overriding the service path/port in subclasses. service_path = service_address || self.class::SERVICE_ADDRESS port = service_port || self.class::DEFAULT_SERVICE_PORT interceptors = self.class::GRPC_INTERCEPTORS @company_service_stub = Google::Gax::Grpc.create_stub( service_path, port, chan_creds: chan_creds, channel: channel, updater_proc: updater_proc, scopes: scopes, interceptors: interceptors, &Google::Cloud::Talent::V4beta1::CompanyService::Stub.method(:new) ) @create_company = Google::Gax.create_api_call( @company_service_stub.method(:create_company), defaults["create_company"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) @get_company = Google::Gax.create_api_call( @company_service_stub.method(:get_company), defaults["get_company"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @update_company = Google::Gax.create_api_call( @company_service_stub.method(:update_company), defaults["update_company"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'company.name' => request.company.name} end ) @delete_company = Google::Gax.create_api_call( @company_service_stub.method(:delete_company), defaults["delete_company"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'name' => request.name} end ) @list_companies = Google::Gax.create_api_call( @company_service_stub.method(:list_companies), defaults["list_companies"], exception_transformer: exception_transformer, params_extractor: proc do |request| {'parent' => request.parent} end ) end |
Class Method Details
.company_path(project, tenant, company) ⇒ String
Returns a fully-qualified company resource name string.
101 102 103 104 105 106 107 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 101 def self.company_path project, tenant, company COMPANY_PATH_TEMPLATE.render( :"project" => project, :"tenant" => tenant, :"company" => company ) end |
.company_without_tenant_path(project, company) ⇒ String
Returns a fully-qualified company_without_tenant resource name string.
113 114 115 116 117 118 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 113 def self.company_without_tenant_path project, company COMPANY_WITHOUT_TENANT_PATH_TEMPLATE.render( :"project" => project, :"company" => company ) end |
.project_path(project) ⇒ String
Returns a fully-qualified project resource name string.
123 124 125 126 127 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 123 def self.project_path project PROJECT_PATH_TEMPLATE.render( :"project" => project ) end |
.tenant_path(project, tenant) ⇒ String
Returns a fully-qualified tenant resource name string.
133 134 135 136 137 138 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 133 def self.tenant_path project, tenant TENANT_PATH_TEMPLATE.render( :"project" => project, :"tenant" => tenant ) end |
Instance Method Details
#company_path(project, tenant, company) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_path.
45 46 47 |
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 45 def company_path project, tenant, company self.class.company_path project, tenant, company end |
#company_without_tenant_path(project, company) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_without_tenant_path.
53 54 55 |
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 53 def company_without_tenant_path project, company self.class.company_without_tenant_path project, company end |
#create_company(parent, company, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Creates a new company entity.
323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 323 def create_company \ parent, company, options: nil, &block req = { parent: parent, company: company }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::CreateCompanyRequest) @create_company.call(req, , &block) end |
#delete_company(name, options: nil) {|result, operation| ... } ⇒ Object
Deletes specified company. Prerequisite: The company has no jobs associated with it.
450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 450 def delete_company \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::DeleteCompanyRequest) @delete_company.call(req, , &block) nil end |
#get_company(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Retrieves specified company.
362 363 364 365 366 367 368 369 370 371 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 362 def get_company \ name, options: nil, &block req = { name: name }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::GetCompanyRequest) @get_company.call(req, , &block) end |
#list_companies(parent, page_size: nil, require_open_jobs: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Company>
Lists all companies associated with the project.
517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 517 def list_companies \ parent, page_size: nil, require_open_jobs: nil, options: nil, &block req = { parent: parent, page_size: page_size, require_open_jobs: require_open_jobs }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::ListCompaniesRequest) @list_companies.call(req, , &block) end |
#project_path(project) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.project_path.
60 61 62 |
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 60 def project_path project self.class.project_path project end |
#tenant_path(project, tenant) ⇒ String
Alias for Google::Cloud::Talent::V4beta1::CompanyServiceClient.tenant_path.
68 69 70 |
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 68 def tenant_path project, tenant self.class.tenant_path project, tenant end |
#update_company(company, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Company
Updates specified company.
411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/google/cloud/talent/v4beta1/company_service_client.rb', line 411 def update_company \ company, update_mask: nil, options: nil, &block req = { company: company, update_mask: update_mask }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::UpdateCompanyRequest) @update_company.call(req, , &block) end |