Class: Cardflex::SubscriptionGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/cardflex/subscription_gateway.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway) ⇒ SubscriptionGateway

Returns a new instance of SubscriptionGateway.



5
6
7
8
# File 'lib/cardflex/subscription_gateway.rb', line 5

def initialize(gateway)
  @gateway = gateway
  @config = gateway.config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/cardflex/subscription_gateway.rb', line 3

def config
  @config
end

Instance Method Details

#_handle_response(res) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cardflex/subscription_gateway.rb', line 14

def _handle_response(res)
  if res[:response][:result] == '1'
    SuccessResponse.new(:subscription => Subscription.new(@gateway, res[:response]))
  else
    ErrorResponse.new(@gateway, res[:response])
  end
end

#request(attributes) ⇒ Object



10
11
12
# File 'lib/cardflex/subscription_gateway.rb', line 10

def request(attributes)
  @config.http.post(attributes)
end