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.
274 275 276 277 278 279 |
# File 'lib/tumblr.rb', line 274 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.
272 273 274 |
# File 'lib/tumblr.rb', line 272 def http @http end |
#num ⇒ Object
Returns the value of attribute num.
272 273 274 |
# File 'lib/tumblr.rb', line 272 def num @num end |
#start ⇒ Object
Returns the value of attribute start.
272 273 274 |
# File 'lib/tumblr.rb', line 272 def start @start end |
#type ⇒ Object
Returns the value of attribute type.
272 273 274 |
# File 'lib/tumblr.rb', line 272 def type @type end |
Instance Method Details
#last_page ⇒ Object
281 282 283 |
# File 'lib/tumblr.rb', line 281 def last_page ((@total - 1) / @num) + 1 end |
#page(pos) ⇒ Object
285 286 287 |
# File 'lib/tumblr.rb', line 285 def page(pos) request(pos*@num, @num) end |