From adf09399c979eb3d280b0979b3d42630bdf4ddb1 Mon Sep 17 00:00:00 2001 From: Alex Fan Date: Mon, 25 Mar 2024 19:17:50 -0400 Subject: [PATCH 1/2] add alias for *_goal_count attr --- lib/openlayer/objects/project_version.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/openlayer/objects/project_version.rb b/lib/openlayer/objects/project_version.rb index 093a2ca..8590103 100644 --- a/lib/openlayer/objects/project_version.rb +++ b/lib/openlayer/objects/project_version.rb @@ -4,6 +4,10 @@ module Openlayer class ProjectVersion < Object attr_reader :client, :project_version_id, :all_attributes_hash + alias :failing_test_count :failing_goal_count + alias :passing_test_count :passing_goal_count + alias :total_test_count :total_goal_count + def self.from_response(client, response) attributes = handle_response(response) new(client, attributes) @@ -21,9 +25,9 @@ def print_status_report end def print_test_report - puts "Failing Test Count: #{failing_test_count}" - puts "Passing Test Count: #{passing_test_count}" - puts "Total Test Count: #{total_test_count}" + puts "Failing Test Count: #{failing_goal_count}" + puts "Passing Test Count: #{passing_goal_count}" + puts "Total Test Count: #{total_goal_count}" end def to_h From 114af3b2ff5dbd91ffd215ffd1fd185679dc3ff8 Mon Sep 17 00:00:00 2001 From: Alex Fan Date: Mon, 25 Mar 2024 20:45:26 -0400 Subject: [PATCH 2/2] do the aliasing in different way to avoid runtime complaints --- Gemfile.lock | 2 +- lib/openlayer/objects/project_version.rb | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c08c98a..7c6d4d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - openlayer (0.2.2) + openlayer (0.3.0) date faraday (~> 2.9.0) faraday-multipart diff --git a/lib/openlayer/objects/project_version.rb b/lib/openlayer/objects/project_version.rb index 8590103..6182e6e 100644 --- a/lib/openlayer/objects/project_version.rb +++ b/lib/openlayer/objects/project_version.rb @@ -4,10 +4,6 @@ module Openlayer class ProjectVersion < Object attr_reader :client, :project_version_id, :all_attributes_hash - alias :failing_test_count :failing_goal_count - alias :passing_test_count :passing_goal_count - alias :total_test_count :total_goal_count - def self.from_response(client, response) attributes = handle_response(response) new(client, attributes) @@ -48,6 +44,18 @@ def refresh @attributes = OpenStruct.new handle_response client.connection.get("versions/#{project_version_id}") end + def failing_test_count + failing_goal_count + end + + def passing_test_count + passing_goal_count + end + + def total_test_count + total_goal_count + end + private def self.handle_response(response)