Sha256: 9de5a54433e0fe8d7f748011b96d82aa8b9072af146740f65a503e4af51918d2

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

module Copy
  module Operations
    module All
      module ClassMethods
        # Retrieves all available objects from the Copy API
        #
        # @param [Hash] options Options to pass to the API
        # @return [Array] The available objects
        def all(attributes = {})
          session = attributes.delete(:session)
          response = Copy.request(:get, nil, api_collection_url , attributes, options_for_request(session: session))
          results_from response
        end

        def results_from(response)
          results = []
          response.each do |obj|
            results << self.new(obj)
          end
          results
        end
        private :results_from
      end

      def self.included(base)
        base.extend(ClassMethods)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copy-ruby-0.0.2 lib/copy/operations/all.rb
copy-ruby-0.0.1 lib/copy/operations/all.rb