Class: RmsApiRuby::Orders
- Inherits:
-
Object
- Object
- RmsApiRuby::Orders
- Defined in:
- lib/rms_api_ruby/orders.rb
Defined Under Namespace
Classes: Client
Constant Summary collapse
- API_METHODS =
i[ get_order update_order cancel_order change_status decision_point r_bank_account_transfer change_r_bank_to_unprocessing do_enclosure do_un_enclosure change_enclosure_parent get_enclosure_list get_request_id get_result ].freeze
Class Method Summary collapse
- .call_api(api_method, args) ⇒ Object
- .handle_error(error) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .respond_to_missing?(method, include_private = false) ⇒ Boolean
Class Method Details
.call_api(api_method, args) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/rms_api_ruby/orders.rb', line 32 def call_api(api_method, args) Flow.new. chain(response: :response) { Client.new(api_method, args) }. on_dam { |error| handle_error(error) }. outflow. try(:response) end |
.handle_error(error) ⇒ Object
40 41 42 43 44 |
# File 'lib/rms_api_ruby/orders.rb', line 40 def handle_error(error) raise error rescue ServerError, AuthenticationError => e RmsApiRuby.logger.error(e.) end |
.method_missing(method, *args) ⇒ Object
24 25 26 |
# File 'lib/rms_api_ruby/orders.rb', line 24 def method_missing(method, *args) API_METHODS.include?(method) ? call_api(method, args.first) : super end |
.respond_to_missing?(method, include_private = false) ⇒ Boolean
28 29 30 |
# File 'lib/rms_api_ruby/orders.rb', line 28 def respond_to_missing?(method, include_private = false) API_METHODS.include?(method) || super end |