Sha256: b1edbd5453e9e41d397bed4c015669a57104047cd0a43e3f915be03f46949fe7

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'genesis_ruby/utils/transactions/travel_data/airline_itinerary/base'
require 'genesis_ruby/utils/money_format'

module GenesisRuby
  module Utils
    module Transactions
      module TravelData
        module AirlineItinerary
          # Signify a single AirlineItinerary Tax data
          class Tax < Base

            attr_reader :fee_type
            attr_accessor :fee_amount, :currency

            # Fee type
            def fee_type=(value)
              limited_string attribute: __method__, value: value, max: 8
            end

            # Get Single Tax structure
            def attributes_structure
              {
                fee_amount: parse_fee_amount,
                fee_type:   fee_type
              }
            end

            protected

            # Minor currency conversion if currency is set
            def parse_fee_amount
              return fee_amount if currency.nil? || fee_amount.nil?

              MoneyFormat.amount_to_exponent fee_amount, currency
            end

          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
genesis_ruby-0.2.0 lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb
genesis_ruby-0.1.9 lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb
genesis_ruby-0.1.8 lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb
genesis_ruby-0.1.7 lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb