Class: Sprites::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/sprites/collection.rb

Overview

Paginated collection of sprites.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sprites:, has_more:, next_continuation_token:) ⇒ Collection

Returns a new instance of Collection.



12
13
14
15
16
# File 'lib/sprites/collection.rb', line 12

def initialize(sprites:, has_more:, next_continuation_token:)
  @sprites = sprites
  @has_more = has_more
  @next_continuation_token = next_continuation_token
end

Instance Attribute Details

#next_continuation_tokenString? (readonly)

Returns token for fetching the next page.

Returns:

  • (String, nil)

    token for fetching the next page



10
11
12
# File 'lib/sprites/collection.rb', line 10

def next_continuation_token
  @next_continuation_token
end

#spritesArray<Sprite> (readonly)

Returns sprites in this page.

Returns:

  • (Array<Sprite>)

    sprites in this page



7
8
9
# File 'lib/sprites/collection.rb', line 7

def sprites
  @sprites
end

Instance Method Details

#has_more?Boolean

Check if more pages are available.

Returns:

  • (Boolean)


21
22
23
# File 'lib/sprites/collection.rb', line 21

def has_more?
  @has_more && !@next_continuation_token.nil?
end