diff --git a/lib/eshop.rb b/lib/eshop.rb index 2a2b86c..306b7df 100644 --- a/lib/eshop.rb +++ b/lib/eshop.rb @@ -70,12 +70,13 @@ def self.list_asia def self.list_americas url = 'https://www.nintendo.com/json/content/get/filter/game' + disable_rails_query_string_format default_params = { limit: 40, system: 'switch', sort: 'title', direction: 'asc', - availability: 'now', + availability: %w(now prepurchase), shop: 'ncom', }.freeze @@ -95,6 +96,7 @@ def self.list_americas # offset += limit # end return games.map do |game| + next unless game[:game_code] && game[:nsuid] { region: 'americas', game_code: game[:game_code], @@ -104,7 +106,7 @@ def self.list_americas nsuid: game[:nsuid], cover_url: game[:front_box_art], } - end + end.compact end end