Module: Google::Cloud
- Defined in:
- lib/google-cloud-vision.rb,
lib/google/cloud/vision.rb,
lib/google/cloud/vision/image.rb,
lib/google/cloud/vision/project.rb,
lib/google/cloud/vision/service.rb,
lib/google/cloud/vision/version.rb,
lib/google/cloud/vision/annotate.rb,
lib/google/cloud/vision/location.rb,
lib/google/cloud/vision/annotation.rb,
lib/google/cloud/vision/credentials.rb,
lib/google/cloud/vision/annotation/face.rb,
lib/google/cloud/vision/annotation/text.rb,
lib/google/cloud/vision/annotation/entity.rb,
lib/google/cloud/vision/annotation/vertex.rb,
lib/google/cloud/vision/annotation/properties.rb,
lib/google/cloud/vision/annotation/safe_search.rb
Defined Under Namespace
Modules: Vision
Class Method Summary collapse
-
.vision(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service.
Instance Method Summary collapse
-
#vision(scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service.
Class Method Details
.vision(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service. Each call creates a new connection.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/google-cloud-vision.rb', line 101 def self.vision project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil require "google/cloud/vision" project ||= Google::Cloud::Vision::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Google::Cloud::Vision::Credentials.default scope: scope else credentials = Google::Cloud::Vision::Credentials.new \ keyfile, scope: scope end Google::Cloud::Vision::Project.new( Google::Cloud::Vision::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
Instance Method Details
#vision(scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Vision::Project
Creates a new object for connecting to the Vision service. Each call creates a new connection.
62 63 64 65 66 |
# File 'lib/google-cloud-vision.rb', line 62 def vision scope: nil, retries: nil, timeout: nil Google::Cloud.vision @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |