Sha256: 95c04673bf69e74a824c363bf56b925986e23250b8d68316a3d4b1f0a6d6a50b

Contents?: true

Size: 1000 Bytes

Versions: 14

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true

module Telnyx
  module APIOperations
    module List
      def list(filters = {}, opts = {})
        opts = Util.normalize_opts(opts)

        resp, opts = request(:get, resource_url, filters, opts)
        obj = ListObject.construct_from(resp.data.merge(url: resource_url), opts)

        # set filters so that we can fetch the same limit, expansions, and
        # predicates when accessing the next and previous pages
        #
        # just for general cleanliness, remove any paging options
        obj.filters = filters.dup
        # obj.filters.delete(:page) # undo this as it interferes with the pagination system...

        obj
      end

      # The original version of #list was given the somewhat unfortunate name of
      # #all, and this alias allows us to maintain backward compatibility (the
      # choice was somewhat misleading in the way that it only returned a single
      # page rather than all objects).
      alias all list
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
telnyx-3.0.5 lib/telnyx/api_operations/list.rb
telnyx-3.0.4 lib/telnyx/api_operations/list.rb
telnyx-3.0.3 lib/telnyx/api_operations/list.rb
telnyx-3.0.2 lib/telnyx/api_operations/list.rb
telnyx-3.0.0 lib/telnyx/api_operations/list.rb
telnyx-2.9.0 lib/telnyx/api_operations/list.rb
telnyx-2.8.0 lib/telnyx/api_operations/list.rb
telnyx-2.7.0 lib/telnyx/api_operations/list.rb
telnyx-2.6.0 lib/telnyx/api_operations/list.rb
telnyx-2.5.0 lib/telnyx/api_operations/list.rb
telnyx-2.4.0 lib/telnyx/api_operations/list.rb
telnyx-2.3.0 lib/telnyx/api_operations/list.rb
telnyx-2.2.0 lib/telnyx/api_operations/list.rb
telnyx-0.1.0 lib/telnyx/api_operations/list.rb