lib/gcloud/vision/connection.rb in gcloud-0.10.0 vs lib/gcloud/vision/connection.rb in gcloud-0.11.0

- old
+ new

@@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. require "gcloud/version" +require "gcloud/backoff" require "google/api_client" module Gcloud module Vision ## @@ -38,17 +39,25 @@ @client.register_discovery_uri "vision", "v1", custom_discovery_url @vision = @client.discovered_api "vision", "v1" end def annotate requests - @client.execute( + execute( api_method: @vision.images.annotate, body_object: { requests: requests } ) end def inspect "#{self.class}(#{@project})" + end + + protected + + def execute options + Gcloud::Backoff.new.execute_gapi do + @client.execute options + end end end end end