Class: Fappu::Page
- Inherits:
-
Object
- Object
- Fappu::Page
- Defined in:
- lib/fappu/page.rb
Instance Attribute Summary collapse
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#page_number ⇒ Object
Returns the value of attribute page_number.
-
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
Class Method Summary collapse
-
.new_from_json(args) ⇒ Object
Receies page has ex.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize(args = {}) ⇒ Page
Returns a new instance of Page.
6 7 8 9 10 |
# File 'lib/fappu/page.rb', line 6 def initialize(args={}) args.each do |k,v| instance_variable_set("@#{k}",v) unless v.nil? end end |
Instance Attribute Details
#image_url ⇒ Object
Returns the value of attribute image_url.
4 5 6 |
# File 'lib/fappu/page.rb', line 4 def image_url @image_url end |
#page_number ⇒ Object
Returns the value of attribute page_number.
4 5 6 |
# File 'lib/fappu/page.rb', line 4 def page_number @page_number end |
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
4 5 6 |
# File 'lib/fappu/page.rb', line 4 def thumbnail_url @thumbnail_url end |
Class Method Details
.new_from_json(args) ⇒ Object
Receies page has ex. self.new_from_json(=> { thumb => ‘xx’, image => ‘yy’)})
Returns #<Page @page_number: 1, @thumbnail_url: ‘xx’, @image_url: ‘yy>
17 18 19 20 21 22 23 24 25 |
# File 'lib/fappu/page.rb', line 17 def self.new_from_json(args) page = Page.new args.each do |k,v| page.page_number = k page.thumbnail_url = v["thumb"] page.image_url = v["image"] end page end |