From c7d490d6825828b39450b7b5c0a342d0a34c38d4 Mon Sep 17 00:00:00 2001 From: Kyle Le Date: Mon, 25 Nov 2024 09:02:34 +0700 Subject: [PATCH] Remove retry code --- .github/workflows/ci.yml | 12 ++++++++++++ lib/killbill_client/models/resource.rb | 19 ++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b67f2a..6140cb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,12 @@ jobs: database-password: 'root' database-port: '3306' docker-compose-file: 'docker-compose.ci.mysql.yml' + - ruby-version: '3.3.5' + database-adapter: 'postgresql' + database-user: 'postgres' + database-password: 'postgres' + database-port: '5432' + docker-compose-file: 'docker-compose.ci.postgresql.yml' - ruby-version: 'jruby-9.1.17.0' database-adapter: 'mysql2' database-user: 'root' @@ -37,6 +43,12 @@ jobs: database-password: 'postgres' database-port: '5432' docker-compose-file: 'docker-compose.ci.postgresql.yml' + - ruby-version: '3.3.5' + database-adapter: 'postgresql' + database-user: 'postgres' + database-password: 'postgres' + database-port: '5432' + docker-compose-file: 'docker-compose.ci.postgresql.yml' - ruby-version: 'jruby-9.1.17.0' database-adapter: 'postgresql' database-user: 'postgres' diff --git a/lib/killbill_client/models/resource.rb b/lib/killbill_client/models/resource.rb index 084571a..70e6ba9 100644 --- a/lib/killbill_client/models/resource.rb +++ b/lib/killbill_client/models/resource.rb @@ -174,15 +174,16 @@ def instantiate_record_from_json(resource_class, data) def attribute(name) send('attr_accessor', name.to_sym) - attributes = @json_attributes ||= [] - begin - json_attributes.push(name.to_s) - rescue NameError - (class << self; self; end). - send(:define_method, :json_attributes) { attributes } - retry - end - end + attributes = @json_attributes ||= [] + + if respond_to?(:json_attributes, true) + json_attributes.push(name.to_s) + else + (class << self; self; end). + send(:define_method, :json_attributes) { attributes } + json_attributes.push(name.to_s) + end + end def has_many(attr_name, type = nil) send("attr_accessor", attr_name.to_sym)