Sha256: 2d20b58d890ae2ca2889b676f57a81432b7f2b22806b1302409dc51cf6b62895
Contents?: true
Size: 779 Bytes
Versions: 2
Compression:
Stored size: 779 Bytes
Contents
module PinPayment class Error < Exception def self.create type, description, messages = nil klass = case type when 'token_already_used'; TokenAlreadyUsed when 'invalid_resource'; InvalidResource when 'resource_not_found'; ResourceNotFound else self end if messages.is_a?(Array) description = description + ' ' + messages.map{|x| "(#{x['message']})" }.join(' & ') elsif messages.is_a?(Hash) description = description + ' ' + messages.values.flatten.map{|x| "(#{x})" }.join(' & ') end klass.new(description) end class InvalidResponse < Error; end class InvalidResource < Error; end class ResourceNotFound < Error; end class TokenAlreadyUsed < Error; end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pin_payment-0.1.0 | lib/pin_payment/error.rb |
pin_payment-0.0.5 | lib/pin_payment/error.rb |