Sha256: f3703747ee5bb83d4bdd7535b5b7c53ac842489178b5bffa368c9cbfc4bf1872

Contents?: true

Size: 923 Bytes

Versions: 9

Compression:

Stored size: 923 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

9 entries across 9 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/models/address.rb
paddle-2.6.0 lib/paddle/models/address.rb
paddle-2.5.2 lib/paddle/models/address.rb
paddle-2.5.1 lib/paddle/models/address.rb
paddle-2.5.0 lib/paddle/models/address.rb
paddle-2.4.1 lib/paddle/models/address.rb
paddle-2.4.0 lib/paddle/models/address.rb
paddle-2.3.0 lib/paddle/models/address.rb
paddle-2.2.1 lib/paddle/models/address.rb