class Sagekit::Collection
Attributes
data[R]
per_page[R]
total[R]
Public Class Methods
from_response(response, type:)
click to toggle source
# File lib/sagekit/collection.rb, line 5 def self.from_response(response, type:) body = response.body new( data: body["value"].map{ |attrs| type.new(attrs) }, total: body.dig("@odata.count"), per_page: body["value"].count ) end
new(data:, total:, per_page:)
click to toggle source
# File lib/sagekit/collection.rb, line 14 def initialize(data:, total:, per_page:) @data = data @total = total @per_page = per_page end