Sha256: ea9dd63ae76bba28a068dc56c7a58a918c862b85d865ed4647f6272437e9c995

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

module RockRMS
  class Client
    module RefundReason
      def list_refund_reasons(options = {})
        options['$filter'] = 'DefinedTypeId eq 37' unless options.keys.include?('$filter')

        Response::DefinedValue.format(
          get(defined_values_path, options)
        )
      end

      def create_refund_reason(value:, description:, order: nil, active: nil)
        order ||= Random.rand(100..1000)

        options = {
          'Value'         => value,
          'Description'   => description,
          'Order'         => order,
          'IsSystem'      => false,
          'DefinedTypeId' => 37
        }
        options['IsActive'] = active if active
        post(defined_values_path, options)
      end

      private

      def defined_values_path
        'DefinedValues'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rock_rms-4.9.0 lib/rock_rms/resources/refund_reason.rb
rock_rms-4.8.0 lib/rock_rms/resources/refund_reason.rb
rock_rms-4.7.0 lib/rock_rms/resources/refund_reason.rb
rock_rms-4.6.0 lib/rock_rms/resources/refund_reason.rb
rock_rms-4.5.0 lib/rock_rms/resources/refund_reason.rb
rock_rms-4.4.0 lib/rock_rms/resources/refund_reason.rb