lib/pagarme/util.rb in pagarme-1.9.2 vs lib/pagarme/util.rb in pagarme-1.9.3
- old
+ new
@@ -1,25 +1,28 @@
+# encoding: utf-8
+require File.join(File.dirname(__FILE__), '..', 'pagarme')
+
module PagarMe
class Util
def self.pagarme_classes
return {
- 'transaction' => Transaction,
- 'plan' => Plan,
- 'customer' => Customer,
- 'subscription' => Subscription,
- 'address' => Address,
- 'phone' => Phone,
+ 'transaction' => Transaction,
+ 'plan' => Plan,
+ 'customer' => Customer,
+ 'subscription' => Subscription,
+ 'address' => Address,
+ 'phone' => Phone,
}
end
def self.convert_to_pagarme_object(response)
case response
when Array
- response.map{ |i| convert_to_pagarme_object(i)}
+ response.map{ |i| convert_to_pagarme_object(i)}
when Hash
- self.pagarme_classes.fetch(response['object'], PagarMeObject).build(response)
+ self.pagarme_classes.fetch(response['object'], PagarMeObject).build(response)
else
- response
+ response
end
end
def self.url_encode(key)
URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))