Sha256: 28550cb23869e007ea46586c73d3ee17914b73aaff07816d8b55e62eea240659
Contents?: true
Size: 379 Bytes
Versions: 3
Compression:
Stored size: 379 Bytes
Contents
module JsonApiClient class ResultSet < Array attr_accessor :total_pages, :total_entries, :offset, :per_page, :current_page, :errors def self.build(klass, data) result_data = data.fetch(klass.table_name, []) new(result_data.map {|attributes| klass.new(attributes) }).tap do |result_set| yield(result_set) if block_given? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json_api_client-0.1.2 | lib/json_api_client/result_set.rb |
json_api_client-0.1.1 | lib/json_api_client/result_set.rb |
json_api_client-0.0.3 | lib/json_api_client/result_set.rb |