From a16672f94f626de811cc1e9365ecdcf247f0df24 Mon Sep 17 00:00:00 2001 From: Tomas Smetka Date: Sun, 28 Dec 2025 15:20:52 +0100 Subject: [PATCH 1/2] Fix test --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 523939d..f884cc8 100644 --- a/README.md +++ b/README.md @@ -323,18 +323,18 @@ name.to_hash # => { 'default' => '...', 'cs' => '...', ... ## API Methods -| Method | Description | -|--------|-------------| -| `import_products(products)` | Bulk import products (max 100) | -| `import_categories(categories)` | Bulk import categories (max 100) | -| `import_parameters(parameters)` | Bulk import parameters (max 100) | -| `import_blogs(blogs)` | Bulk import blogs (max 100) | -| `get_products(page:, per_page:, last_update_from:, is_edited:)` | Get products page | -| `get_categories(page:, per_page:, last_update_from:, is_edited:)` | Get categories page | -| `get_blogs(page:, per_page:, last_update_from:, is_edited:)` | Get blogs page | -| `each_product(last_update_from:, is_edited:)` | Iterate all products | -| `each_category(last_update_from:, is_edited:)` | Iterate all categories | -| `each_blog(last_update_from:, is_edited:)` | Iterate all blogs | +| Method | Description | +|-------------------------------------------------------------------|----------------------------------| +| `import_products(products)` | Bulk import products (max 100) | +| `import_categories(categories)` | Bulk import categories (max 100) | +| `import_parameters(parameters)` | Bulk import parameters (max 100) | +| `import_blogs(blogs)` | Bulk import blogs (max 100) | +| `get_products(page:, per_page:, last_update_from:, is_edited:)` | Get products page | +| `get_categories(page:, per_page:, last_update_from:, is_edited:)` | Get categories page | +| `get_blogs(page:, per_page:, last_update_from:, is_edited:)` | Get blogs page | +| `each_product(last_update_from:, is_edited:)` | Iterate all products | +| `each_category(last_update_from:, is_edited:)` | Iterate all categories | +| `each_blog(last_update_from:, is_edited:)` | Iterate all blogs | ## Development From 088bf8ae76a20abb46dfecc6e7472e7500db2260 Mon Sep 17 00:00:00 2001 From: Tomas Smetka Date: Sun, 28 Dec 2025 15:24:19 +0100 Subject: [PATCH 2/2] Fix boolean parsing in from_hash methods --- lib/pobo/dto/blog.rb | 4 ++-- lib/pobo/dto/category.rb | 4 ++-- lib/pobo/dto/product.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pobo/dto/blog.rb b/lib/pobo/dto/blog.rb index f4bf5fb..2965f48 100644 --- a/lib/pobo/dto/blog.rb +++ b/lib/pobo/dto/blog.rb @@ -40,7 +40,7 @@ def initialize( def self.from_hash(hash) new( id: hash["id"] || hash[:id], - is_visible: hash["is_visible"] || hash[:is_visible], + is_visible: hash.key?("is_visible") ? hash["is_visible"] : hash[:is_visible], name: LocalizedString.from_hash(hash["name"] || hash[:name]), url: LocalizedString.from_hash(hash["url"] || hash[:url]), category: hash["category"] || hash[:category], @@ -49,7 +49,7 @@ def self.from_hash(hash) seo_description: LocalizedString.from_hash(hash["seo_description"] || hash[:seo_description]), content: Content.from_hash(hash["content"] || hash[:content]), images: hash["images"] || hash[:images] || [], - is_loaded: hash["is_loaded"] || hash[:is_loaded], + is_loaded: hash.key?("is_loaded") ? hash["is_loaded"] : hash[:is_loaded], created_at: parse_time(hash["created_at"] || hash[:created_at]), updated_at: parse_time(hash["updated_at"] || hash[:updated_at]) ) diff --git a/lib/pobo/dto/category.rb b/lib/pobo/dto/category.rb index 47931a5..3910cf4 100644 --- a/lib/pobo/dto/category.rb +++ b/lib/pobo/dto/category.rb @@ -40,7 +40,7 @@ def initialize( def self.from_hash(hash) new( id: hash["id"] || hash[:id], - is_visible: hash["is_visible"] || hash[:is_visible], + is_visible: hash.key?("is_visible") ? hash["is_visible"] : hash[:is_visible], name: LocalizedString.from_hash(hash["name"] || hash[:name]), url: LocalizedString.from_hash(hash["url"] || hash[:url]), description: LocalizedString.from_hash(hash["description"] || hash[:description]), @@ -49,7 +49,7 @@ def self.from_hash(hash) content: Content.from_hash(hash["content"] || hash[:content]), images: hash["images"] || hash[:images] || [], guid: hash["guid"] || hash[:guid], - is_loaded: hash["is_loaded"] || hash[:is_loaded], + is_loaded: hash.key?("is_loaded") ? hash["is_loaded"] : hash[:is_loaded], created_at: parse_time(hash["created_at"] || hash[:created_at]), updated_at: parse_time(hash["updated_at"] || hash[:updated_at]) ) diff --git a/lib/pobo/dto/product.rb b/lib/pobo/dto/product.rb index 38b583a..f4c4f0a 100644 --- a/lib/pobo/dto/product.rb +++ b/lib/pobo/dto/product.rb @@ -48,7 +48,7 @@ def initialize( def self.from_hash(hash) new( id: hash["id"] || hash[:id], - is_visible: hash["is_visible"] || hash[:is_visible], + is_visible: hash.key?("is_visible") ? hash["is_visible"] : hash[:is_visible], name: LocalizedString.from_hash(hash["name"] || hash[:name]), url: LocalizedString.from_hash(hash["url"] || hash[:url]), short_description: LocalizedString.from_hash(hash["short_description"] || hash[:short_description]), @@ -60,7 +60,7 @@ def self.from_hash(hash) categories_ids: hash["categories_ids"] || hash[:categories_ids] || [], parameters_ids: hash["parameters_ids"] || hash[:parameters_ids] || [], guid: hash["guid"] || hash[:guid], - is_loaded: hash["is_loaded"] || hash[:is_loaded], + is_loaded: hash.key?("is_loaded") ? hash["is_loaded"] : hash[:is_loaded], categories: hash["categories"] || hash[:categories] || [], created_at: parse_time(hash["created_at"] || hash[:created_at]), updated_at: parse_time(hash["updated_at"] || hash[:updated_at])