Sha256: 5d9d02f10df1cb17cf329ee99ec33a311af4d886f1bac24d217978802ccd2e43

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

module PaymentTest

  class PluginPropertyUtils

    def self.get_property_or_nil(properties, key_name)
      test_props = (properties || []).select { |e| e.key == key_name }
      if test_props.size > 1
        raise ArgumentError.new "multiple property with key #{key_name} is not allowed"
      end
      test_props.size == 1 ? test_props[0] : nil
    end

    def self.validate_properties(properties)
      if properties.nil?
        return
      end

      if !properties.is_a? Array
        raise ArgumentError.new "properties should be an Array"
      end

      properties.each do |p|
        if !p.is_a? Killbill::Plugin::Model::PluginProperty
          raise ArgumentError.new "Each property should be of type Killbill::Plugin::Model::PluginProperty"
        end
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
killbill-payment-test-3.2.0 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-3.1.0 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-3.0.0 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-2.1.0 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-1.8.7 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-1.8.6 lib/payment_test/plugin_property_utils.rb
killbill-payment-test-1.8.5 lib/payment_test/plugin_property_utils.rb