You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to instantiate a service I get this error:
NameError: wrong constant name BI-Customers
from /home/barry/.rvm/gems/ruby-2.2.2/gems/ruby_odata-0.1.6/lib/ruby_odata/class_builder.rb:53:in `const_set'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/ruby_odata-0.1.6/lib/ruby_odata/class_builder.rb:53:in `build'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/ruby_odata-0.1.6/lib/ruby_odata/service.rb:281:in `block in build_collections_and_classes'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/ruby_odata-0.1.6/lib/ruby_odata/service.rb:276:in `build_collections_and_classes'
from /home/barry/.rvm/gems/ruby-2.2.2/gems/ruby_odata-0.1.6/lib/ruby_odata/service.rb:20:in `initialize'
from (irb):2:in `new'
from (irb):2
from /home/barry/.rvm/rubies/ruby-2.2.2/bin/irb:11:in `<main>'
I tried making a small change in lib/ruby_odata/service.rb line 349:
def qualify_class_name(klass_name)
unless @namespace.nil? || @namespace.blank? || klass_name.include?('::')
namespaces = @namespace.split(/\.|::/)
namespaces << klass_name
klass_name = namespaces.join '::'
end
klass_name.camelize.gsub('-','') #### I changed this
end
Now I can instantiate the service, and select the collection:
Is everything prefixed the same? If so you could probably add an option for model prefix (or something like that) and have the QueryBuilder add that prefix when it creates the queries. Then you could just do svc.Customers
First of all, thank you for creating this gem. It's really useful.
I'm attempting to work with an OData source that has dashes in the collections names:
When I try to instantiate a service I get this error:
I tried making a small change in
lib/ruby_odata/service.rb
line 349:Now I can instantiate the service, and select the collection:
It would be nice if I could simply write
svc.BICustomers
instead ofsvc.send "BI-Customers"
Any ideas how I can make that heppen?
Thanks so much
Barry
The text was updated successfully, but these errors were encountered: