Class: KapsoClientRuby::Types::PagedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/kapso_client_ruby/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, item_class = nil) ⇒ PagedResponse

Returns a new instance of PagedResponse.



124
125
126
127
128
129
130
131
# File 'lib/kapso_client_ruby/types.rb', line 124

def initialize(data, item_class = nil)
  @data = if item_class && data['data'].is_a?(Array)
            data['data'].map { |item| item_class.new(item) }
          else
            data['data'] || []
          end
  @paging = GraphPaging.new(data['paging'] || {})
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



122
123
124
# File 'lib/kapso_client_ruby/types.rb', line 122

def data
  @data
end

#pagingObject (readonly)

Returns the value of attribute paging.



122
123
124
# File 'lib/kapso_client_ruby/types.rb', line 122

def paging
  @paging
end