Class: Fassbinder::BookBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/fassbinder/book_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBookBuilder

Returns a new instance of BookBuilder.



8
9
10
11
# File 'lib/fassbinder/book_builder.rb', line 8

def initialize
  @book = Kosher::Book.new
  @book.offers = []
end

Instance Attribute Details

#bookObject (readonly)

Returns the value of attribute book.



6
7
8
# File 'lib/fassbinder/book_builder.rb', line 6

def book
  @book
end

Instance Method Details

#add_offer(hash) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/fassbinder/book_builder.rb', line 13

def add_offer(hash)
  builder = OfferBuilder.new
  builder.id = hash['OfferListing']['OfferListingId']
  builder.venue = @book.venue
  builder.add_item(hash)
  builder.add_seller(hash['Merchant'])
  builder.add_shipping(hash)
  @book.offers << builder.offer
end

#asin=(asin) ⇒ Object



23
24
25
# File 'lib/fassbinder/book_builder.rb', line 23

def asin=(asin)
  @book.asin = asin
end

#offers_total=(count) ⇒ Object



31
32
33
# File 'lib/fassbinder/book_builder.rb', line 31

def offers_total=(count)
  @book.offers_total = count.to_i
end

#venue=(venue) ⇒ Object



27
28
29
# File 'lib/fassbinder/book_builder.rb', line 27

def venue=(venue)
  @book.venue = venue
end