Sha256: 90fc53b5c8635a2b1b6d2148e4e370e8faf25042a31fb9ebfdad1faa96397762
Contents?: true
Size: 722 Bytes
Versions: 1
Compression:
Stored size: 722 Bytes
Contents
module Nusii class ResponseObject attr_accessor :resources, :meta, :resource_class def initialize resources, meta, resource_class @resources = resources @meta = meta @resource_class = resource_class end def next_page raise(ArgumentError, "That page does no exist") if meta['next_page'] == nil resource_class.list(:page => meta['next_page'], :per => per_page) end def prev_page raise(ArgumentError, "That page does no exist") if meta['prev_page'] == nil resource_class.list(:page => meta['prev_page'], :per => per_page) end private def per_page (meta['total_count'] / meta['total_pages'].to_f).round end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nusii-0.1.1 | lib/nusii/response_object.rb |