From 99040452623c0c6c5e6b1e9c09e256d768feb546 Mon Sep 17 00:00:00 2001 From: Alessandro Lepore Date: Thu, 14 Sep 2023 15:14:31 +0200 Subject: [PATCH 1/2] Set default values as callables So it's possible to load the code even if ENV vars are not set --- lib/we_ship_client/entities/order_item.rb | 2 +- lib/we_ship_client/entities/process_orders_request.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/we_ship_client/entities/order_item.rb b/lib/we_ship_client/entities/order_item.rb index 168aae6..6879787 100644 --- a/lib/we_ship_client/entities/order_item.rb +++ b/lib/we_ship_client/entities/order_item.rb @@ -8,7 +8,7 @@ module Entities class OrderItem < Base attribute :productName, Types::Strict::String attribute :productSKU, Types::Strict::String - attribute :productType, Types::Strict::String.default(ENV['WE_SHIP_DEFAULT_PRODUCT_TYPE']) + attribute :productType, Types::Strict::String.default { ENV['WE_SHIP_DEFAULT_PRODUCT_TYPE'] } attribute :quantity, Types::Strict::Integer attribute :weight, Types::Strict::String end diff --git a/lib/we_ship_client/entities/process_orders_request.rb b/lib/we_ship_client/entities/process_orders_request.rb index e2d9685..1931f29 100644 --- a/lib/we_ship_client/entities/process_orders_request.rb +++ b/lib/we_ship_client/entities/process_orders_request.rb @@ -15,9 +15,9 @@ class ProcessOrdersRequest < Base # :description=>"Invalid content was found starting with element 'clientCode'. One of '{order}' is expected.", # :status=>"Fail" # }}} - attribute :formatVersion, Types::Strict::String.default(ENV['WE_SHIP_FORMAT_VERSION']) - attribute :clientCode, Types::Strict::String.default(ENV['WE_SHIP_CUSTOMER_CODE']) - attribute :allowDuplicates, Types::Strict::String.default(ENV['WE_SHIP_ALLOW_DUPLICATES']) + attribute :formatVersion, Types::Strict::String.default { ENV['WE_SHIP_FORMAT_VERSION'] } + attribute :clientCode, Types::Strict::String.default { ENV['WE_SHIP_CUSTOMER_CODE'] } + attribute :allowDuplicates, Types::Strict::String.default { ENV['WE_SHIP_ALLOW_DUPLICATES'] } attribute :order, Types::Strict::Array.of(Order) end end From 454166489e91d9f46bd1781b9ab33e00673c66fe Mon Sep 17 00:00:00 2001 From: Alessandro Lepore Date: Thu, 14 Sep 2023 16:14:49 +0200 Subject: [PATCH 2/2] Bump version --- Gemfile.lock | 3 ++- lib/we_ship_client/version.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 71ed5b3..23eb759 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - we_ship_client (1.1.0) + we_ship_client (1.1.1) activesupport dry-struct (~> 1.4) dry-types @@ -94,6 +94,7 @@ GEM zeitwerk (2.6.9) PLATFORMS + arm64-darwin-21 arm64-darwin-22 x86_64-darwin-20 x86_64-darwin-21 diff --git a/lib/we_ship_client/version.rb b/lib/we_ship_client/version.rb index df8dfc3..2accbf7 100644 --- a/lib/we_ship_client/version.rb +++ b/lib/we_ship_client/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WeShipClient - VERSION = '1.1.0' + VERSION = '1.1.1' end