Sha256: e23b88fce2b28ee7416a9447ac60ef1ccf9bb748392b243c2fe71ea826888870

Contents?: true

Size: 762 Bytes

Versions: 5

Compression:

Stored size: 762 Bytes

Contents

module Tangany
  module Customers
    class CustomersResource < Resource
      BASE_PATH = "customers"

      def create(**params)
        Customer.new(post_request(BASE_PATH, body: sanitize_params!(params).to_json).body)
      end

      def delete(customer_id)
        delete_request("#{BASE_PATH}/#{customer_id}")
      end

      def list(**params)
        Collection.from_response(get_request(BASE_PATH, params: sanitize_params!(params)), type: Customer)
      end

      def retrieve(customer_id)
        Customer.new(get_request("#{BASE_PATH}/#{customer_id}").body)
      end

      def update(customer_id, **params)
        Customer.new(put_request("#{BASE_PATH}/#{customer_id}", body: sanitize_params!(params).to_json).body)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tangany-0.0.5 lib/tangany/customers/resources/customers_resource.rb
tangany-0.0.4 lib/tangany/customers/resources/customers_resource.rb
tangany-0.0.3 lib/tangany/customers/resources/customers_resource.rb
tangany-0.0.2 lib/tangany/customers/resources/customers_resource.rb
tangany-0.0.1 lib/tangany/customers/resources/customers_resource.rb