Sha256: d40a2e373f327d8298fbb1c53d5c0c50c0250d4672e8831979379aa6d2a18a70
Contents?: true
Size: 741 Bytes
Versions: 17
Compression:
Stored size: 741 Bytes
Contents
module QuickTravel module PriceChanges class PriceChange attr_reader :target attr_reader :original_price, :changed_price, :price_change, :reason delegate :positive?, :negative?, to: :price_change def initialize(attrs = {}) @target = OpenStruct.new(attrs.fetch('target').slice('id', 'type')) @original_price = Money.new(attrs.fetch('original_price_in_cents')) @changed_price = Money.new(attrs.fetch('changed_price_in_cents')) @price_change = Money.new(attrs.fetch('price_change_in_cents')) @reason = attrs.fetch('reason') end def applied_on?(id, type = 'Reservation') @target.type == type && @target.id == id end end end end
Version data entries
17 entries across 17 versions & 1 rubygems