Sha256: c2da2176e4b68984d7b47bd667b3bb54828779ded4afd80e8b6271aab0cb51d4
Contents?: true
Size: 613 Bytes
Versions: 8
Compression:
Stored size: 613 Bytes
Contents
# ApiClient::Collection handle a collection of objects class ApiClient::Collection include Enumerable attr_accessor :collection # Initialize a collection of given objects # # @param [Class] klass The class to instantiate the objects. # @param [String] resource_path The url to get the data. # @return [Collection] the collection of objects. def initialize(klass, resource_path) url = "#{ApiClient.config.path}#{resource_path}" @collection = ApiClient::Parser.response(ApiClient::Dispatcher.get(url), url) @collection.map! do |attributes| klass.new(attributes) end end end
Version data entries
8 entries across 8 versions & 1 rubygems