Sha256: e2b827a92b24c29f7e1532e3ff3002c5e009e28bd15602442897e0ae71377068

Contents?: true

Size: 494 Bytes

Versions: 3

Compression:

Stored size: 494 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cardflex-ruby-0.1.2 lib/cardflex/plan_gateway.rb
cardflex-ruby-0.1.1 lib/cardflex/plan_gateway.rb
cardflex-ruby-0.0.1 lib/cardflex/plan_gateway.rb