Module: PayPal::Recurring::Utils

Included in:
Notification, Response::Base
Defined in:
lib/paypal/recurring/utils.rb

Instance Method Summary collapse

Instance Method Details

#convert_to_time(string) ⇒ Object



4
5
6
# File 'lib/paypal/recurring/utils.rb', line 4

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

#mapping(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/paypal/recurring/utils.rb', line 8

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