Sha256: ecdb045728a0ebc68a78e8503ffa11914980ae6cc6eda2b4ff0720684260fb5b

Contents?: true

Size: 925 Bytes

Versions: 10

Compression:

Stored size: 925 Bytes

Contents

module Paddle
  class Address < Object

    class << self

      def list(customer:, **params)
        response = Client.get_request("customers/#{customer}/addresses", params: params)
        Collection.from_response(response, type: Address)
      end

      def create(customer:, country_code:, postal_code:, **params)
        attrs = {country_code: country_code, postal_code: postal_code}
        response = Client.post_request("customers/#{customer}/addresses", body: attrs.merge(params))
        Address.new(response.body["data"])
      end

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

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

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
paddle-2.2.0 lib/paddle/models/address.rb
paddle-2.1.4 lib/paddle/models/address.rb
paddle-2.1.3 lib/paddle/models/address.rb
paddle-2.1.2 lib/paddle/models/address.rb
paddle-2.1.1 lib/paddle/models/address.rb
paddle-2.1.0 lib/paddle/models/address.rb
paddle-2.0.0 lib/paddle/models/address.rb
paddle-1.1.2 lib/paddle/models/address.rb
paddle-1.1.1 lib/paddle/models/address.rb
paddle-1.1.0 lib/paddle/models/address.rb