Class: Spotify::Models::Paging

Inherits:
Object
  • Object
show all
Defined in:
lib/spotify/models/paging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}, klass) ⇒ Paging

Sets the arguments to its variables.

Parameters:

  • args (Hash) (defaults to: {})

    the arguments that will be placed on each variable.

  • klass (Spotify::Model)

    the model’s class that is represented on items’s array.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/spotify/models/paging.rb', line 19

def initialize(args = {}, klass)
  args = Hash(args).with_indifferent_access

  # Arrays
  items = Array(args[:items]).map { |i| klass.new(i) }

  @href     = args[:href]
  @items    = items
  @limit    = args[:limit]
  @next     = args[:next]
  @offset   = args[:offset]
  @previous = args[:previous]
  @total    = args[:total]
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def href
  @href
end

#itemsObject (readonly)

Returns the value of attribute items.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def items
  @items
end

#limitObject (readonly)

Returns the value of attribute limit.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def limit
  @limit
end

#nextObject (readonly)

Returns the value of attribute next.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def next
  @next
end

#offsetObject (readonly)

Returns the value of attribute offset.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def offset
  @offset
end

#previousObject (readonly)

Returns the value of attribute previous.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def previous
  @previous
end

#totalObject (readonly)

Returns the value of attribute total.



7
8
9
# File 'lib/spotify/models/paging.rb', line 7

def total
  @total
end