rootstrap/best_buy_ruby

View on GitHub
lib/best_buy/helpers/conditions/pre_owned_condition.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module BestBuy
  module Conditions
    class PreOwnedCondition
      def initialize(condition_hash)
        @item_condition = condition_hash[:item_condition]&.downcase
      end

      def valid?
        @item_condition.present? && @item_condition == 'pre-owned'
      end

      def search_query
        '(condition=pre-owned|preowned=true)'
      end
    end
  end
end