Class: ContentfulLite::BaseArray

Inherits:
Delegator
  • Object
show all
Defined in:
lib/contentful_lite/base_array.rb

Direct Known Subclasses

AssetsArray, EntriesArray

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ BaseArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BaseArray.

Parameters:

  • raw (Hash)

    raw response from Contentful API



12
13
14
15
16
17
# File 'lib/contentful_lite/base_array.rb', line 12

def initialize(raw)
  @total = raw['total']
  @skip = raw['skip']
  @limit = raw['limit']
  @items = raw.fetch('items', [])
end

Instance Attribute Details

#limitObject (readonly)

The maximum number of resources returned per request



8
9
10
# File 'lib/contentful_lite/base_array.rb', line 8

def limit
  @limit
end

#skipObject (readonly)

The skip parameter sent to Contentful API for getting this result



6
7
8
# File 'lib/contentful_lite/base_array.rb', line 6

def skip
  @skip
end

#totalObject (readonly)

The total number of items in the result



4
5
6
# File 'lib/contentful_lite/base_array.rb', line 4

def total
  @total
end

Instance Method Details

#__getobj__Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/contentful_lite/base_array.rb', line 20

def __getobj__
  @items
end

#__setobj__(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/contentful_lite/base_array.rb', line 25

def __setobj__(value)
  @items = value
end