Class: PHRMgr::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- PHRMgr::Configuration
- Defined in:
- lib/medical_records/phr_mgr/configuration.rb
Overview
HTTP client configuration for Client
Instance Attribute Summary
Attributes inherited from Common::Client::Configuration::Base
#base_request_headers, #open_timeout, #read_timeout, #request_types, #user_agent
Instance Method Summary collapse
-
#base_path ⇒ String
Base path for dependent URLs.
-
#connection ⇒ Faraday::Connection
Creates a connection.
-
#service_name ⇒ String
Service name to use in breakers and metrics.
-
#x_auth_key_headers ⇒ Hash
Headers with X-Authorization-Key header value for dependent URLs.
Methods inherited from Common::Client::Configuration::Base
#breakers_error_threshold, #breakers_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception
Instance Method Details
#base_path ⇒ String
Returns Base path for dependent URLs.
21 22 23 |
# File 'lib/medical_records/phr_mgr/configuration.rb', line 21 def base_path "#{Settings.mhv.medical_records.host}/mhvapi/v2/phrmgr/" end |
#connection ⇒ Faraday::Connection
Creates a connection
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/medical_records/phr_mgr/configuration.rb', line 44 def connection Faraday.new(base_path, headers: base_request_headers, request: ) do |conn| conn.use :breakers conn.request :multipart_request conn.request :multipart conn.request :json # Uncomment this if you want curl command equivalent or response output to log # conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production? # conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production? conn.response :raise_custom_error, error_prefix: service_name conn.response :mhv_errors conn.response :mhv_xml_html_errors conn.response :json_parser conn.adapter Faraday.default_adapter end end |
#service_name ⇒ String
Returns Service name to use in breakers and metrics.
35 36 37 |
# File 'lib/medical_records/phr_mgr/configuration.rb', line 35 def service_name 'PHRMgr' end |
#x_auth_key_headers ⇒ Hash
Returns Headers with X-Authorization-Key header value for dependent URLs.
28 29 30 |
# File 'lib/medical_records/phr_mgr/configuration.rb', line 28 def x_auth_key_headers base_request_headers.merge('X-Authorization-Key' => Settings.mhv.medical_records.x_auth_key) end |