Class: Clashinator::ArrayResource

Inherits:
Object
  • Object
show all
Defined in:
lib/clashinator/array_resource.rb

Overview

This class represents the array resource model This is only for array-based responses that contains an items attribute and a paging attribute

Defined Under Namespace

Classes: Cursor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, items, paging = { 'cursors' => {} }) ⇒ ArrayResource

Returns a new instance of ArrayResource.



9
10
11
12
13
14
15
# File 'lib/clashinator/array_resource.rb', line 9

def initialize(model, items, paging = { 'cursors' => {} })
  @model = model
  @items = as_array_of_model(items)
  @paging = Clashinator::ArrayResource::Cursor.new(
    paging['cursors']
  )
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



7
8
9
# File 'lib/clashinator/array_resource.rb', line 7

def items
  @items
end

#modelObject

Returns the value of attribute model.



7
8
9
# File 'lib/clashinator/array_resource.rb', line 7

def model
  @model
end

#pagingObject

Returns the value of attribute paging.



7
8
9
# File 'lib/clashinator/array_resource.rb', line 7

def paging
  @paging
end