Sha256: abbabf9c395521135a84de96cb9f72da8f9a816ccbe00b62882348d6596962b6

Contents?: true

Size: 1000 Bytes

Versions: 7

Compression:

Stored size: 1000 Bytes

Contents

module AdaptivePayments
  class ConvertCurrencyRequest < AbstractRequest
    operation :ConvertCurrency

    attribute :base_amount_list,         Node[CurrencyList],     :param => "baseAmountList"
    attribute :convert_to_currency_list, NodeList[CurrencyCode], :param => "convertToCurrencyList"
    attribute :country_code,             String,                 :param => "countryCode"
    attribute :conversion_type,          String,                 :param => "conversionType"

    alias_params :base_amount_list, {
      :currencies => :currencies
    }

    alias_params :first_currency, {
      :amount     => :amount,
      :code       => :code
    }

    def convert_to_currencies
      convert_to_currency_list.collect { |info| info[:code] }
    end
    
    def convert_to_currencies=(list_of_currencies)
      self.convert_to_currency_list = list_of_currencies.map { |t| { :code => t } }
    end

    private

    def first_currency
      currencies[0] ||= CurrencyList.new
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
creative-pp-adaptive-1.1.1 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-1.0.0 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-0.0.6 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-0.0.5 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-0.0.4 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-0.0.3 lib/pp-adaptive/convert_currency_request.rb
pp-adaptive-0.0.2 lib/pp-adaptive/convert_currency_request.rb