Module: OSTSdk::Util::ServicesHelper
- Included in:
- Saas::Base
- Defined in:
- lib/ost-sdk-ruby/util/services_helper.rb
Instance Method Summary collapse
-
#current_time ⇒ Object
returns current time.
-
#current_timestamp ⇒ Object
returns current timestamp.
-
#perform_and_handle_exceptions(internal_id = 'swr', msg = 'Something Went Wrong', &block) ⇒ Object
Wrapper Method which could be used to execute business logic Error handling code wraps execution of business logic.
Instance Method Details
#current_time ⇒ Object
returns current time
Returns:
Time
31 32 33 |
# File 'lib/ost-sdk-ruby/util/services_helper.rb', line 31 def current_time @c_time ||= Time.now end |
#current_timestamp ⇒ Object
returns current timestamp
Returns:
Integer
40 41 42 |
# File 'lib/ost-sdk-ruby/util/services_helper.rb', line 40 def @c_tstamp ||= current_time.to_f end |
#perform_and_handle_exceptions(internal_id = 'swr', msg = 'Something Went Wrong', &block) ⇒ Object
Wrapper Method which could be used to execute business logic Error handling code wraps execution of business logic
Arguments:
err_code: (String)
err_message: (String)
block: (Proc)
Returns:
response: (Hash)
18 19 20 21 22 23 24 |
# File 'lib/ost-sdk-ruby/util/services_helper.rb', line 18 def perform_and_handle_exceptions(internal_id = 'swr', msg = 'Something Went Wrong', &block) begin yield if block_given? rescue StandardError => se OSTSdk::Util::CustomErrorResponse.new({internal_id: internal_id, msg: msg}).default_error_response end end |