Class: Gestpay::Result::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gestpay/result/base.rb

Direct Known Subclasses

Decrypt, Delete, Encrypt, Payment, Settle, TokenRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/gestpay/result/base.rb', line 7

def initialize(data)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



19
20
21
# File 'lib/gestpay/result/base.rb', line 19

def method_missing(method_name, *args)
  data.has_key?(method_name) ? data[method_name] : super
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/gestpay/result/base.rb', line 5

def data
  @data
end

Instance Method Details

#errorObject



15
16
17
# File 'lib/gestpay/result/base.rb', line 15

def error
  "Error #{ error_code }: #{ error_description }" if error_code
end

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/gestpay/result/base.rb', line 11

def success?
  transaction_result == 'OK'
end