Class: ComicVine::ResourceList
Overview
Class container for multiple ComicVine resources
Instance Attribute Summary collapse
- #resource ⇒ Object readonly
Attributes inherited from List
#cvos, #limit, #offset, #page_count, #total_count
Instance Method Summary collapse
-
#initialize(resp, resc) ⇒ ResourceList
constructor
A new instance of ResourceList.
- #next_page ⇒ Object
- #prev_page ⇒ Object
Methods inherited from List
Constructor Details
#initialize(resp, resc) ⇒ ResourceList
Returns a new instance of ResourceList.
52 53 54 55 56 57 |
# File 'lib/comicvine/list.rb', line 52 def initialize(resp, resc) super(resp) @resource = resc @cvos = resp['results'].map { |r| ComicVine::Resource.create_resource(r) } end |
Instance Attribute Details
#resource ⇒ Object (readonly)
50 51 52 |
# File 'lib/comicvine/list.rb', line 50 def resource @resource end |
Instance Method Details
#next_page ⇒ Object
59 60 61 62 |
# File 'lib/comicvine/list.rb', line 59 def next_page return nil if (@offset + @page_count) >= @total_count update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset + @page_count)})) end |
#prev_page ⇒ Object
64 65 66 67 |
# File 'lib/comicvine/list.rb', line 64 def prev_page return nil if @offset == 0 update_ivals(ComicVine::API.send(@resource, {:limit => @limit, :offset => (@offset - @page_count)})) end |