rootstrap/best_buy_ruby

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

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

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

      def valid?
        @item_condition.present? && @item_condition == 'new'
      end

      def search_query
        '(condition=new|new=true)'
      end
    end
  end
end