Module: Isomorfeus::Operation::GenericClassApi
- Defined in:
- lib/isomorfeus/operation/generic_class_api.rb
Instance Method Summary collapse
- #_process_response(agent) ⇒ Object
- #current_user ⇒ Object
- #promise_daily(**props_hash) ⇒ Object
- #promise_daily_exist?(**props_hash) ⇒ Boolean
- #promise_deferred(**props_hash) ⇒ Object
- #promise_remove_daily(**props_hash) ⇒ Object
- #promise_run(**props_hash) ⇒ Object
Instance Method Details
#_process_response(agent) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 9 def _process_response(agent) agent.process do |agnt| agnt.response[:result] end if agent.result.key?(:rejected) if agent.result.key?(:error) e = agent.result[:error] exception_class_name = e[:class_name] exception_class = exception_class_name.constantize exception = exception_class.new(e[:message]) exception.set_backtrace(e[:backtrace]) raise exception else raise agent.result[:rejected] end else agent.result[:resolved] end end |
#current_user ⇒ Object
4 5 6 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 4 def current_user Isomorfeus.current_user end |
#promise_daily(**props_hash) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 41 def promise_daily(**props_hash) key = props_hash.delete(:key) props = validated_props(props_hash) props[:key] = key if key Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, :daily, props) .then { |agent| _process_response(agent) } end |
#promise_daily_exist?(**props_hash) ⇒ Boolean
55 56 57 58 59 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 55 def promise_daily_exist?(**props_hash) raise "key: must be given" unless props_hash.key?(:key) Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, :daily_exist, props_hash) .then { |agent| _process_response(agent) } end |
#promise_deferred(**props_hash) ⇒ Object
35 36 37 38 39 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 35 def promise_deferred(**props_hash) props = validated_props(props_hash) Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, :deferred, props) .then { |agent| _process_response(agent) } end |
#promise_remove_daily(**props_hash) ⇒ Object
49 50 51 52 53 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 49 def promise_remove_daily(**props_hash) raise "key: must be given" unless props_hash.key?(:key) Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, :remove_daily, props_hash) .then { |agent| _process_response(agent) } end |
#promise_run(**props_hash) ⇒ Object
29 30 31 32 33 |
# File 'lib/isomorfeus/operation/generic_class_api.rb', line 29 def promise_run(**props_hash) props = validated_props(props_hash) Isomorfeus::Transport.promise_send_path('Isomorfeus::Operation::Handler::OperationHandler', self.name, :run, props) .then { |agent| _process_response(agent) } end |