Skip to content

Commit edc586d

Browse files
committed
feat(VisualRecognitionV4): add get training usage method
1 parent f3b6ed6 commit edc586d

File tree

2 files changed

+93
-137
lines changed

2 files changed

+93
-137
lines changed

lib/ibm_watson/visual_recognition_v4.rb

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616

1717
# Provide images to the IBM Watson™ Visual Recognition service for analysis. The
1818
# service detects objects based on a set of images with training data.
19-
#
20-
# **Beta:** The Visual Recognition v4 API and Object Detection model are beta features.
21-
# For more information about beta features, see the [Release
22-
# notes](https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-release-notes#beta).
23-
# {: important}
2419

2520
require "concurrent"
2621
require "erb"
@@ -503,7 +498,9 @@ def delete_image(collection_id:, image_id:)
503498
# Download a JPEG representation of an image.
504499
# @param collection_id [String] The identifier of the collection.
505500
# @param image_id [String] The identifier of the image.
506-
# @param size [String] Specify the image size.
501+
# @param size [String] The image size. Specify `thumbnail` to return a version that maintains the
502+
# original aspect ratio but is no larger than 200 pixels in the larger dimension.
503+
# For example, an original 800 x 1000 image is resized to 160 x 200 pixels.
507504
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
508505
def get_jpeg_image(collection_id:, image_id:, size: nil)
509506
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -614,6 +611,42 @@ def add_image_training_data(collection_id:, image_id:, objects: nil)
614611
)
615612
response
616613
end
614+
615+
##
616+
# @!method get_training_usage(start_time: nil, end_time: nil)
617+
# Get training usage.
618+
# Information about the completed training events. You can use this information to
619+
# determine how close you are to the training limits for the month.
620+
# @param start_time [String] The earliest day to include training events. Specify dates in YYYY-MM-DD format.
621+
# If empty or not specified, the earliest training event is included.
622+
# @param end_time [String] The most recent day to include training events. Specify dates in YYYY-MM-DD
623+
# format. All events for the day are included. If empty or not specified, the
624+
# current day is used. Specify the same value as `start_time` to request events for
625+
# a single day.
626+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
627+
def get_training_usage(start_time: nil, end_time: nil)
628+
headers = {
629+
}
630+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_training_usage")
631+
headers.merge!(sdk_headers)
632+
633+
params = {
634+
"version" => @version,
635+
"start_time" => start_time,
636+
"end_time" => end_time
637+
}
638+
639+
method_url = "/v4/training_usage"
640+
641+
response = request(
642+
method: "GET",
643+
url: method_url,
644+
headers: headers,
645+
params: params,
646+
accept_json: true
647+
)
648+
response
649+
end
617650
#########################
618651
# User data
619652
#########################

0 commit comments

Comments
 (0)