Class: Kitely::Photobook

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Photobook

Returns a new instance of Photobook.



5
6
7
8
# File 'lib/kitely/photobook.rb', line 5

def initialize(options = {})
  self.template_id = options[:template] || 'photobook_wrap_21x21_square'
  self.pages = []
end

Instance Attribute Details

#back_coverObject

Returns the value of attribute back_cover.



3
4
5
# File 'lib/kitely/photobook.rb', line 3

def back_cover
  @back_cover
end

#front_coverObject

Returns the value of attribute front_cover.



3
4
5
# File 'lib/kitely/photobook.rb', line 3

def front_cover
  @front_cover
end

#pagesObject

Returns the value of attribute pages.



3
4
5
# File 'lib/kitely/photobook.rb', line 3

def pages
  @pages
end

#template_idObject

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

#attributesObject



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