Sha256: c707f446cd6a0c4c93aac1a5e1cc0426ba586ab450faa3057d270c7df95608bc

Contents?: true

Size: 692 Bytes

Versions: 5

Compression:

Stored size: 692 Bytes

Contents

module PayPal
  module Recurring
    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

5 entries across 5 versions & 2 rubygems

Version Path
didil-paypal-recurring-1.1.1 lib/paypal/recurring/utils.rb
paypal-recurring-1.1.0 lib/paypal/recurring/utils.rb
paypal-recurring-1.0.0 lib/paypal/recurring/utils.rb
paypal-recurring-0.1.6 lib/paypal/recurring/utils.rb
paypal-recurring-0.1.5 lib/paypal/recurring/utils.rb