module Cardflex class PlanGateway attr_reader :config def initialize(gateway) @gateway = gateway @config = gateway.config end def request(attributes) res = config.http.post(attributes) _handle_response(res) end def _handle_response(res) if res[:response][:result] == '1' SuccessResponse.new(:plan => Plan.new(@gateway, res[:response])) else ErrorResponse.new(@gatway, res[:response]) end end end end