Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/pobo/dto/blog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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])
)
Expand Down
4 changes: 2 additions & 2 deletions lib/pobo/dto/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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])
)
Expand Down
4 changes: 2 additions & 2 deletions lib/pobo/dto/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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])
Expand Down