Class: Gcloud::Vision::Connection
- Inherits:
-
Object
- Object
- Gcloud::Vision::Connection
- Defined in:
- lib/gcloud/vision/connection.rb
Overview
as well as expose the API calls.
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #annotate(requests) ⇒ Object
-
#initialize(project, credentials) ⇒ Connection
constructor
Creates a new Connection instance.
- #inspect ⇒ Object
Constructor Details
#initialize(project, credentials) ⇒ Connection
Creates a new Connection instance.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gcloud/vision/connection.rb', line 31 def initialize project, credentials @project = project @credentials = credentials @client = Google::APIClient.new application_name: "gcloud-ruby", application_version: Gcloud::VERSION @client. = @credentials.client custom_discovery_url = Addressable::URI.parse( "https://vision.googleapis.com/$discovery/rest?version=v1") @client.register_discovery_uri "vision", "v1", custom_discovery_url @vision = @client.discovered_api "vision", "v1" end |
Instance Attribute Details
#credentials ⇒ Object
Returns the value of attribute credentials.
27 28 29 |
# File 'lib/gcloud/vision/connection.rb', line 27 def credentials @credentials end |
#project ⇒ Object
Returns the value of attribute project.
26 27 28 |
# File 'lib/gcloud/vision/connection.rb', line 26 def project @project end |
Instance Method Details
#annotate(requests) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/gcloud/vision/connection.rb', line 43 def annotate requests execute( api_method: @vision.images.annotate, body_object: { requests: requests } ) end |
#inspect ⇒ Object
50 51 52 |
# File 'lib/gcloud/vision/connection.rb', line 50 def inspect "#{self.class}(#{@project})" end |