Sha256: 174ab51d1308d7117c7624f2b92d5812b6b68e068b5bed7608b05c5380105845
Contents?: true
Size: 695 Bytes
Versions: 3
Compression:
Stored size: 695 Bytes
Contents
module Paymill module Request class Validator attr_reader :info attr_accessor :response def initialize(info) @info = info end def validated_data_for(incoming_response) self.response = incoming_response verify_response_code info.data = JSON.parse(response.body) validate_response_data info.data end protected def verify_response_code raise AuthenticationError if response.code.to_i == 401 raise APIError if response.code.to_i >= 500 end def validate_response_data raise APIError.new(info.data["error"]) if info.data["error"] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paymill-0.5.1 | lib/paymill/request/validator.rb |
paymill-0.5.0 | lib/paymill/request/validator.rb |
paymill-0.4.0 | lib/paymill/request/validator.rb |