Class: PaymobRuby::ApplicationService

Inherits:
Object
  • Object
show all
Defined in:
lib/paymob_ruby/api/application_service.rb

Direct Known Subclasses

Login, PayCard, PayToken, PaymentToken

Defined Under Namespace

Classes: Response

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



9
10
11
12
13
14
# File 'lib/paymob_ruby/api/application_service.rb', line 9

def self.call(...)
  service = new
  service.call(...)
rescue StandardError => e
  service.failure(e)
end

Instance Method Details

#failure(exception) ⇒ Object



20
21
22
# File 'lib/paymob_ruby/api/application_service.rb', line 20

def failure(exception)
  Response.new(false, nil, exception)
end

#success(payload = nil) ⇒ Object



16
17
18
# File 'lib/paymob_ruby/api/application_service.rb', line 16

def success(payload = nil)
  Response.new(true, payload)
end