Class: Ghtk::Validations::ShippingFeeValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/ghtk/validations/shipping_fee_validation.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ ShippingFeeValidation

Returns a new instance of ShippingFeeValidation.



4
5
6
# File 'lib/ghtk/validations/shipping_fee_validation.rb', line 4

def initialize(hash)
  @hash = hash
end

Instance Method Details

#validate!Object



8
9
10
11
12
# File 'lib/ghtk/validations/shipping_fee_validation.rb', line 8

def validate!
  blank_params = REQUIRED_PARAMS.select { |key| Ghtk.is_blank?(hash[key]) }
  raise Ghtk::BadParamsError.new("Params: #{blank_params.join(', ')} is blank!") unless blank_params.empty?
  return true
end