Sha256: fd850bb5c578a487347ecbec845af3c8a80c037dc5d576f01a03736a11f19e5f

Contents?: true

Size: 1020 Bytes

Versions: 4

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8

module Nimbu
  module Endpoints
    class Customers < Endpoint
      def list(*args)
        arguments(args)

        response = get_request("/customers", arguments.params)
        return response unless block_given?
        response.each { |el| yield el }
      end
      alias :all :list

      def get(*args)
        arguments(args, :required => [:customer_id])

        get_request("/customers/#{customer_id}", arguments.params)
      end
      alias :find :get

      def create(*args)
        arguments(args)

        post_request("/customers", arguments.params)
      end

      def update(*args)
        arguments(args, :required => [:customer_id])

        patch_request("/customers/#{customer_id}", arguments.params)
      end
      alias :edit :update

      def delete(*args)
        arguments(args, :required => [:customer_id])

        delete_request("/customers/#{customer_id}", arguments.params)
      end
      alias :remove :delete

    end # Customers
  end # Endpoints
end # Nimbu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nimbu-api-0.3.0 lib/nimbu-api/endpoints/customers.rb
nimbu-api-0.2.1 lib/nimbu-api/endpoints/customers.rb
nimbu-api-0.2 lib/nimbu-api/endpoints/customers.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/endpoints/customers.rb