Module: EwayRapid::Message::RestProcess
- Included in:
- CustomerProcess::CustDirectPaymentMsgProcess, CustomerProcess::CustDirectUpdateMsgProcess, CustomerProcess::CustResponsiveSharedMsgProcess, CustomerProcess::CustResponsiveUpdateMsgProcess, CustomerProcess::CustTransparentRedirectMsgProcess, CustomerProcess::CustTransparentUpdateMsgProcess, CustomerProcess::QueryCustomerMsgProcess, EwayRapid::Message::RefundProcess::CancelAuthorisationMsgProcess, EwayRapid::Message::RefundProcess::RefundMsgProcess, TransactionProcess::CapturePaymentMsgProcess, TransactionProcess::SettlementSearchMsgProcess, TransactionProcess::TransDirectPaymentMsgProcess, TransactionProcess::TransQueryMsgProcess, TransactionProcess::TransResponsiveSharedMsgProcess, TransactionProcess::TransTransparentRedirectMsgProcess
- Defined in:
- lib/eway_rapid/message/process/rest_process.rb
Instance Method Summary collapse
-
#do_get(url, api_key, password) ⇒ Object
Call restful web service with get method.
-
#do_post(url, api_key, password, request) ⇒ Object
Call restful web service with post method.
Instance Method Details
#do_get(url, api_key, password) ⇒ Object
Call restful web service with get method
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/eway_rapid/message/process/rest_process.rb', line 42 def do_get(url, api_key, password) begin RestClient::Request.new( :method => :get, :url => url, :user => api_key, :password => password, :headers => { :accept => :json, :content_type => :json, :user_agent => get_user_agent } ).execute rescue SocketError => e raise Exceptions::CommunicationFailureException.new(e.to_s) rescue RestClient::Exception => e if e.http_code == 401 || e.http_code == 403 || e.http_code == 404 raise Exceptions::AuthenticationFailureException.new(e.to_s) else raise Exceptions::SystemErrorException.new(e.to_s) end end end |
#do_post(url, api_key, password, request) ⇒ Object
Call restful web service with post method
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eway_rapid/message/process/rest_process.rb', line 11 def do_post(url, api_key, password, request) begin RestClient::Request.execute( :method => :post, :url => url, :user => api_key, :password => password, :payload => request.to_json, :timeout => 9000000, :headers => { :accept => :json, :content_type => :json, :user_agent => get_user_agent } ) rescue SocketError => e raise Exceptions::CommunicationFailureException.new(e.to_s) rescue RestClient::Exception => e if e.http_code == 401 || e.http_code == 403 || e.http_code == 404 raise Exceptions::AuthenticationFailureException.new(e.to_s) else raise Exceptions::SystemErrorException.new(e.to_s) end end end |