Sha256: 78dced845bf0b756a194428ea31bbcc37fdc680fe82262095b0283f8950bca0a

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

module Tangany
  module Customers
    class NaturalPersonsResource < Resource
      BASE_PATH = "entities/natural-persons"

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

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

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

      def retrieve(entity_id)
        NaturalPerson.new(get_request("#{BASE_PATH}/#{entity_id}").body)
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tangany-0.0.5 lib/tangany/customers/resources/natural_persons_resource.rb
tangany-0.0.4 lib/tangany/customers/resources/natural_persons_resource.rb
tangany-0.0.3 lib/tangany/customers/resources/natural_persons_resource.rb