Class: Kitely::Photobook
- Inherits:
-
Object
- Object
- Kitely::Photobook
- Defined in:
- lib/kitely/photobook.rb
Instance Attribute Summary collapse
-
#back_cover ⇒ Object
Returns the value of attribute back_cover.
-
#front_cover ⇒ Object
Returns the value of attribute front_cover.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#template_id ⇒ Object
Returns the value of attribute template_id.
Instance Method Summary collapse
- #add_page(page) ⇒ Object
- #attributes ⇒ Object
-
#initialize(options = {}) ⇒ Photobook
constructor
A new instance of Photobook.
Constructor Details
#initialize(options = {}) ⇒ Photobook
Returns a new instance of Photobook.
5 6 7 8 |
# File 'lib/kitely/photobook.rb', line 5 def initialize( = {}) self.template_id = [:template] || 'photobook_wrap_21x21_square' self.pages = [] end |
Instance Attribute Details
#back_cover ⇒ Object
Returns the value of attribute back_cover.
3 4 5 |
# File 'lib/kitely/photobook.rb', line 3 def back_cover @back_cover end |
#front_cover ⇒ Object
Returns the value of attribute front_cover.
3 4 5 |
# File 'lib/kitely/photobook.rb', line 3 def front_cover @front_cover end |
#pages ⇒ Object
Returns the value of attribute pages.
3 4 5 |
# File 'lib/kitely/photobook.rb', line 3 def pages @pages end |
#template_id ⇒ Object
Returns the value of attribute template_id.
3 4 5 |
# File 'lib/kitely/photobook.rb', line 3 def template_id @template_id end |
Instance Method Details
#add_page(page) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/kitely/photobook.rb', line 10 def add_page(page) if page.is_a?(String) page = { asset: page } end self.pages << { layout: 'single_centered' }.merge(page) end |
#attributes ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kitely/photobook.rb', line 17 def attributes { template_id: self.template_id, assets: { front_cover: self.front_cover, back_cover: self.back_cover, pages: self.pages } } end |