require 'helix_web_services_client/open_model' class HelixWebServicesClient # List all counters in the system. # Each counter typically has a `counter` and `value` attribute. def counters arr = execute_method_no_body(:get, hve_path('counters')) arr.map { |a| OpenModel.new(a) } end # Return the counter hash for a particular counter key. # # @param counter [String] The counter ID def counter(counter) obj = execute_method_no_body(:get, hve_path("counters/#{URI.encode(counter)}")) OpenModel.new(obj) end # Increment the value of a numerical counter # # @param counter [String] The counter ID def increment_counter(counter) execute_method_no_body(:post, hve_path("counters/#{URI.encode(counter)}/increment")) end # Set the counter value # # @param counter [Hash|OpenModel] A has containing `counter` and `value` properties def set_counter(counter) counter = OpenModel.new(counter) unless counter.is_a?(OpenModel) execute_method_with_body(:put, hve_path("counters/#{URI.encode(counter.counter)}"), counter.marshal_dump) end # Delete the counter # # @param counter [String] The counter ID def delete_counter(counter) execute_method_no_body(:delete, hve_path("counters/#{URI.encode(counter)}")) end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 17274 | tjuricek |
Initial revision of Ruby client API. Removing a bunch of the "helper method aliases" and specs that no longer run. The 2016.1 API will be much more like the Java (and TBD C++) APIs. |
||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/lib/helix_web_services_client/counters.rb | |||||
#2 | 15240 | tjuricek |
Set api level via request path on all Helix Versioning Engine methods. This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly. P4WEBAPI-118 |
||
#1 | 15225 | tjuricek |
Revise counter implementation, tests, and documentation Wasn't available in the Ruby client before, so, it's now available. |