165
166
167
168
169
170
171
172
173
174
|
# File 'lib/jekyll/shopsavvy/tags.rb', line 165
def shopsavvy_lookup(identifier)
site = @context.registers[:site]
api_key = ENV["SHOPSAVVY_API_KEY"] || site.config.dig("shopsavvy", "api_key")
return {} if api_key.nil?
client = Jekyll::Shopsavvy::Client.new(api_key: api_key, cache: (site.config["__shopsavvy_cache"] ||= {}))
client.product_details(identifier.to_s)
rescue StandardError => e
Jekyll.logger.warn("ShopSavvy:", "lookup failed: #{e.message}")
{}
end
|