Sha256: 0a3eb68b3629f79def58993045f9e33e662794d5c997e13f4a0b3f391ec9c2e7

Contents?: true

Size: 656 Bytes

Versions: 4

Compression:

Stored size: 656 Bytes

Contents

require 'uri'

module Voucherify
  module Service
    class ValidationRules
      attr_reader :client

      def initialize(client)
        @client = client
      end

      def create(validation_rules)
        @client.post('/validation-rules', validation_rules.to_json)
      end

      def get(id)
        @client.get("/validation-rules/#{URI.encode(id)}")
      end

      def update(validation_rules)
        @client.put("/validation-rules/#{URI.encode(validation_rules['id'] || validation_rules[:id])}", validation_rules.to_json)
      end

      def delete(id)
        @client.delete("/validation-rules/#{URI.encode(id)}")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voucherify-1.6.1 lib/voucherify/service/validation_rules.rb
voucherify-1.6.0 lib/voucherify/service/validation_rules.rb
voucherify-1.5.0 lib/voucherify/service/validation_rules.rb
voucherify-1.4.0 lib/voucherify/service/validation_rules.rb