Class: Tumblr::API::Reader
- Inherits:
-
Object
- Object
- Tumblr::API::Reader
- Defined in:
- lib/tumblr.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
Returns the value of attribute http.
-
#num ⇒ Object
Returns the value of attribute num.
-
#start ⇒ Object
Returns the value of attribute start.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(http, num = 20, type = nil) ⇒ Reader
constructor
A new instance of Reader.
- #last_page ⇒ Object
- #page(pos) ⇒ Object
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
#http ⇒ Object
Returns the value of attribute http.
287 288 289 |
# File 'lib/tumblr.rb', line 287 def http @http end |
#num ⇒ Object
Returns the value of attribute num.
287 288 289 |
# File 'lib/tumblr.rb', line 287 def num @num end |
#start ⇒ Object
Returns the value of attribute start.
287 288 289 |
# File 'lib/tumblr.rb', line 287 def start @start end |
#type ⇒ Object
Returns the value of attribute type.
287 288 289 |
# File 'lib/tumblr.rb', line 287 def type @type end |
Instance Method Details
#last_page ⇒ Object
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 |