Sha256: 8be5c9e440e2dbd9bb6a73f222eeb28a6ed581ce28871731973e9a9598e18489

Contents?: true

Size: 610 Bytes

Versions: 13

Compression:

Stored size: 610 Bytes

Contents

require 'uri'

module Voucherify
  module Service
    class Customers
      attr_reader :client

      def initialize(client)
        @client = client
      end

      def create(customer)
        @client.post('/customers', customer.to_json)
      end

      def get(customer_id)
        @client.get("/customers/#{URI.encode(customer_id)}")
      end

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

      def delete(customer_id)
        @client.delete("/customers/#{URI.encode(customer_id)}")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
voucherify-2.4.0 lib/voucherify/service/customers.rb
voucherify-2.3.0 lib/voucherify/service/customers.rb
voucherify-2.2.0 lib/voucherify/service/customers.rb
voucherify-2.1.1 lib/voucherify/service/customers.rb
voucherify-2.1.0 lib/voucherify/service/customers.rb
voucherify-2.0.0 lib/voucherify/service/customers.rb
voucherify-1.6.1 lib/voucherify/service/customers.rb
voucherify-1.6.0 lib/voucherify/service/customers.rb
voucherify-1.5.0 lib/voucherify/service/customers.rb
voucherify-1.4.0 lib/voucherify/service/customers.rb
voucherify-1.3.0 lib/voucherify/service/customers.rb
voucherify-1.2.0 lib/voucherify/service/customers.rb
voucherify-1.1.0 lib/voucherify/service/customers.rb