class ShippingRate < Struct.new(:id, :shipping_method, :name, :cost)
  def initialize(attributes={})
    attributes.each do |k,v|
      self.send("#{k}=", v)
    end
  end

end

module Spree
  class ShippingRate < Struct.new(:id, :shipping_method, :name, :cost)
    def initialize(attributes={})
      attributes.each do |k,v|
        self.send("#{k}=", v)
      end
    end
  end
end

Make sure shipping rate is within Spree module
Make sure shipping rate is within Spree module
