class OData::Model::Railtie

Defines the necessary hooks to work correctly with Ruby on Rails. @api private

Attributes

configuration[RW]

Private Instance Methods

generate_options(service_name, service_details) click to toggle source
# File lib/odata/model/railtie.rb, line 24
def generate_options(service_name, service_details)
  options = { name: service_name }
  if service_details[:username] && service_details[:password]
    options[:typhoeus] = {
        username: service_details[:username],
        password: service_details[:password]
    }
    options[:typhoeus][:httpauth] = service_details[:auth_type].to_sym
  end
  options
end
validate_service_setup(service_name) click to toggle source
# File lib/odata/model/railtie.rb, line 36
def validate_service_setup(service_name)
  service = OData::ServiceRegistry[service_name]
  service.namespace
rescue StandardError
  raise RuntimeError, "could not access service at #{service.service_url}"
end