Class: ApiBanking::JsonClient
- Inherits:
-
Object
- Object
- ApiBanking::JsonClient
- Defined in:
- lib/api_banking/json/json_client.rb
Direct Known Subclasses
AccountStatement, GetAccountBalance, GetPaymentStatus, PanInquiry, SinglePayment
Class Method Summary collapse
Class Method Details
.do_remote_call(env, dataHash, callbacks = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/api_banking/json/json_client.rb', line 6 def self.do_remote_call(env, dataHash, callbacks = nil) = {} [:method] = :post add_signature(dataHash) [:body] = JSON.generate(dataHash) [:headers] = {'Content-Type' => "application/json; charset=utf-8", 'User-Agent' => "Quantiguous; API Banking, Ruby Gem #{ApiBanking::VERSION}"} (env, ) set_params_for_environment(env, ) request = Typhoeus::Request.new(env.endpoints[self.name.split('::').last.to_sym], ) callbacks.before_send.call(request) if (callbacks && callbacks.before_send.respond_to?(:call)) response = request.run callbacks.on_complete.call(request.response) if (callbacks && callbacks.on_complete.respond_to?(:call)) Thread.current[:last_response] = response parse_response(response) end |