Class: ComicVine::CVObjectList

Inherits:
CVList
  • Object
show all
Defined in:
lib/comic_vine/cv_list.rb

Instance Attribute Summary collapse

Attributes inherited from CVList

#cvos, #limit, #offset, #total_count

Instance Method Summary collapse

Methods inherited from CVList

#each, #last

Constructor Details

#initialize(resp, resc) ⇒ CVObjectList

Returns a new instance of CVObjectList.



37
38
39
40
41
42
# File 'lib/comic_vine/cv_list.rb', line 37

def initialize(resp, resc)      
  super(resp)
  
  @resource = resc
  @cvos = resp['results'].map{ |r| ComicVine::CVObject.new(r)}
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



35
36
37
# File 'lib/comic_vine/cv_list.rb', line 35

def resource
  @resource
end

Instance Method Details

#next_pageObject



44
45
46
47
# File 'lib/comic_vine/cv_list.rb', line 44

def next_page
  return nil if (@offset + count) == @total_count
  update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset + count)}))
end

#prev_pageObject



49
50
51
52
# File 'lib/comic_vine/cv_list.rb', line 49

def prev_page
  return nil if @offset == 0
  update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset - count)}))
end