Sha256: 1a3f08676dd97098b8f6c6c4385a9e833ff6d2ab5903ad2552d6ce10ac683fc2

Contents?: true

Size: 691 Bytes

Versions: 7

Compression:

Stored size: 691 Bytes

Contents

require 'kosher'
require 'fassbinder/offer_builder'

module Fassbinder
  class BookBuilder
    attr_reader :book

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

    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

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fassbinder-0.0.15 lib/fassbinder/book_builder.rb
fassbinder-0.0.14 lib/fassbinder/book_builder.rb
fassbinder-0.0.13 lib/fassbinder/book_builder.rb
fassbinder-0.0.12 lib/fassbinder/book_builder.rb
fassbinder-0.0.11 lib/fassbinder/book_builder.rb
fassbinder-0.0.10 lib/fassbinder/book_builder.rb
fassbinder-0.0.9 lib/fassbinder/book_builder.rb