Hello
I’m getting these errors:
LoadError (Expected /home/amree/myapp/lib/company/api.rb to define Api):
activesupport (3.2.13) lib/active_support/dependencies.rb:503:in `load_missing_constant'
activesupport (3.2.13) lib/active_support/dependencies.rb:192:in `block in const_missing'
activesupport (3.2.13) lib/active_support/dependencies.rb:190:in `each'
activesupport (3.2.13) lib/active_support/dependencies.rb:190:in `const_missing'
activesupport (3.2.13) lib/active_support/inflector/methods.rb:230:in `block in constantize'
activesupport (3.2.13) lib/active_support/inflector/methods.rb:229:in `each'
activesupport (3.2.13) lib/active_support/inflector/methods.rb:229:in `constantize'
activesupport (3.2.13) lib/active_support/dependencies.rb:554:in `get'
I’m calling the class from this controller:
# myapp/app/controllers/api/something_controller.rb
class Api::SomethingController < ApplicationController
def index
# TODO: Verify q
q = params[:q]
@result = Company::Api.new().send("get_sdf_#{q}",
rn: "123",
limit: params[:limit])
#...
end
And this is the class:
# myapp/lib/company/api.rb
module Company
class Api
include HTTParty
base_uri "#{API_CONFIG['scheme']}://#{API_CONFIG['host']}"
digest_auth API_CONFIG['email'], API_CONFIG['key']
DEFAULT_OPTIONS = {
limit: 1
}
#...
end
Thanks in advance.