class FidorApi::Collection
Attributes
current_page[R]
per_page[R]
records[R]
total_entries[R]
total_pages[R]
Public Class Methods
new(klass:, raw:)
click to toggle source
# File lib/fidor_api/collection.rb, line 14 def initialize(klass:, raw:) @current_page = raw.fetch('collection').fetch('current_page') @per_page = raw.fetch('collection').fetch('per_page') @total_entries = raw.fetch('collection').fetch('total_entries') @total_pages = raw.fetch('collection').fetch('total_pages') @records = raw.fetch('data').map { |attributes| klass.new(attributes) } end
Public Instance Methods
each(&block)
click to toggle source
# File lib/fidor_api/collection.rb, line 22 def each(&block) records.each(&block) end