Class: BBInternal::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- BBInternal::Configuration
- Defined in:
- lib/medical_records/bb_internal/configuration.rb
Overview
HTTP client configuration for PHRMgr::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
-
#app_token ⇒ String
BB Internal uses the same app token as Rx.
-
#base_path ⇒ String
BB Internal uses the same domain as Medical Records FHIR.
-
#connection ⇒ Faraday::Connection
Creates a connection.
-
#service_name ⇒ String
Service name to use in breakers and metrics.
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
#app_token ⇒ String
BB Internal uses the same app token as Rx.
22 23 24 |
# File 'lib/medical_records/bb_internal/configuration.rb', line 22 def app_token Settings.mhv.rx.app_token end |
#base_path ⇒ String
BB Internal uses the same domain as Medical Records FHIR.
30 31 32 |
# File 'lib/medical_records/bb_internal/configuration.rb', line 30 def base_path "#{Settings.mhv.medical_records.host}/mhvapi/v1/" end |
#connection ⇒ Faraday::Connection
Creates a connection
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/medical_records/bb_internal/configuration.rb', line 46 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.
37 38 39 |
# File 'lib/medical_records/bb_internal/configuration.rb', line 37 def service_name 'BBInternal' end |