Sha256: 22f8789e510fe0bf34f0e43d3b7639b96dcfa81f205a92e50288a9c5629c8ae9

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

module Paddle
  class Customer < Object

    class << self

      def list(**params)
        response = Client.get_request("customers", params: params)
        Collection.from_response(response, type: Customer)
      end

      def create(email:, **params)
        attrs = {email: email.gsub(/\s+/, "")}
        response = Client.post_request("customers", body: attrs.merge(params))
        Customer.new(response.body["data"])
      end

      def retrieve(id:)
        response = Client.get_request("customers/#{id}")
        Customer.new(response.body["data"])
      end

      def update(id:, **params)
        response = Client.patch_request("customers/#{id}", body: params)
        Customer.new(response.body["data"])
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paddle-2.1.1 lib/paddle/models/customer.rb