Class: ComicVine::CVSearchList

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, query) ⇒ CVSearchList

Returns a new instance of CVSearchList.



59
60
61
62
63
64
65
# File 'lib/comic_vine/cv_list.rb', line 59

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

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



57
58
59
# File 'lib/comic_vine/cv_list.rb', line 57

def query
  @query
end

#resourceObject (readonly)

Returns the value of attribute resource.



56
57
58
# File 'lib/comic_vine/cv_list.rb', line 56

def resource
  @resource
end

Instance Method Details

#next_pageObject



67
68
69
70
# File 'lib/comic_vine/cv_list.rb', line 67

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

#prev_pageObject



72
73
74
75
# File 'lib/comic_vine/cv_list.rb', line 72

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