Sha256: 256d35fd13aa0dc00a0cdf03ee10bd2e0d419501ec326350e282832d3ff1a412

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

module PayPal
  module ExpressCheckout
    module Utils
      def convert_to_time(string)
        DateTime.strptime(string, "%H:%M:%S %b %e, %Y %Z").new_offset(0)
      end

      def mapping(options = {})
        options.each do |to, from|
          class_eval <<-RUBY
            def #{to}
              @#{to} ||= begin
                from = [#{from.inspect}].flatten
                name = from.find {|name| params[name]}
                value = nil
                value = params[name] if name
                value = send("build_#{to}", value) if respond_to?("build_#{to}", true)
                value
              end
            end
          RUBY
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paypal-payment-0.1.2 lib/paypal/express_checkout/utils.rb