Class: Tumblr::API::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/tumblr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http, num = 20, type = nil) ⇒ Reader

Returns a new instance of Reader.



289
290
291
292
293
294
# File 'lib/tumblr.rb', line 289

def initialize(http, num=20, type=nil)
  @http = http
  @num = num
  @type = type
  @total = request(0, 0).posts.total
end

Instance Attribute Details

#httpObject

Returns the value of attribute http.



287
288
289
# File 'lib/tumblr.rb', line 287

def http
  @http
end

#numObject

Returns the value of attribute num.



287
288
289
# File 'lib/tumblr.rb', line 287

def num
  @num
end

#startObject

Returns the value of attribute start.



287
288
289
# File 'lib/tumblr.rb', line 287

def start
  @start
end

#typeObject

Returns the value of attribute type.



287
288
289
# File 'lib/tumblr.rb', line 287

def type
  @type
end

Instance Method Details

#last_pageObject



296
297
298
# File 'lib/tumblr.rb', line 296

def last_page
  ((@total - 1) / @num) + 1
end

#page(pos) ⇒ Object



300
301
302
# File 'lib/tumblr.rb', line 300

def page(pos)
  request(pos*@num, @num)
end