Module: MITS::V3_0::Mapper::DepositMapper

Included in:
MITS::V3_0::Mapper, MITS::V4_1::Mapper
Defined in:
lib/mits/v3.0/mapper/deposit_mapper.rb

Instance Method Summary collapse

Instance Method Details

#deposit(tag, entity = Deposit) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/mits/v3.0/mapper/deposit_mapper.rb', line 10

def deposit(tag, entity = Deposit)
  entity.new(amount:             deposit_amount(tag[:Amount][:ValueRange]),
             description:        tag[:Description],
             percent_refundable: try(tag[:PercentRefundable], :to_f),
             portion_refundable: try(tag[:PortionRefundable], :to_f),
             type:               tag[:DepositType])
end

#deposits(tags, entity = Deposit) ⇒ Object



5
6
7
8
# File 'lib/mits/v3.0/mapper/deposit_mapper.rb', line 5

def deposits(tags, entity = Deposit)
  tags = [tags] unless tags.is_a? Array
  tags.map { |tag| deposit(tag, entity) }
end