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.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gcloud/vision/connection.rb', line 30 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.
26 27 28 |
# File 'lib/gcloud/vision/connection.rb', line 26 def credentials @credentials end |
#project ⇒ Object
Returns the value of attribute project.
25 26 27 |
# File 'lib/gcloud/vision/connection.rb', line 25 def project @project end |
Instance Method Details
#annotate(requests) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/gcloud/vision/connection.rb', line 42 def annotate requests @client.execute( api_method: @vision.images.annotate, body_object: { requests: requests } ) end |
#inspect ⇒ Object
49 50 51 |
# File 'lib/gcloud/vision/connection.rb', line 49 def inspect "#{self.class}(#{@project})" end |