Closed luckyraul closed 8 years ago
Can you provide me with the full EDMX and the Results XML? With these I should be able to generate a failing test to help me sort out this issue.
Sorry for the delayed reply, I was on vacation.
Is that the result of the call to http://myServer.com/myService.svc/$metadata
(obviously replacing myServer
and myService
)? Also, what version of OData are you using?
Thank you for that. When do you get the error? It seems to parse the EDMX ok, so you must be peforming a query?
Just created OData::Service.new object with url, nothing more
This test is passing on my machine using your EDMX:
describe "properly parse build function import" do
before(:each) do
# Required for the build_classes method
stub_request(:get, "http://test.com/test.svc/$metadata").
with(:headers => DEFAULT_HEADERS).
to_return(:status => 200, :body => File.new(File.expand_path("../fixtures/build_function_imports/bfi_metadata.xml", __FILE__)), :headers => {})
end
it "should not error with 'undefined method `content' for nil:NilClass'" do
lambda { OData::Service.new "http://test.com/test.svc" }.should_not raise_error
end
end
I just tried it using 0.1.6 in irb
. OData::Service.new
works fine. I'm using Ruby 2.2.2, but I don't think that could be the issue, though you never know. What version of Ruby are you using?
x=Document.create_in_1c
NoMethodError: undefined method `content' for nil:NilClass
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/ruby_odata-0.1.0/lib/ruby_odata/service.rb:244:in `block in build_function_imports'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.3/lib/nokogiri/xml/node_set.rb:187:in `block in each'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.3/lib/nokogiri/xml/node_set.rb:186:in `upto'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.3/lib/nokogiri/xml/node_set.rb:186:in `each'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/ruby_odata-0.1.0/lib/ruby_odata/service.rb:243:in `build_function_imports'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/ruby_odata-0.1.0/lib/ruby_odata/service.rb:236:in `build_collections_and_classes'
from /Users/nikita/.rvm/gems/ruby-2.2.3/gems/ruby_odata-0.1.0/lib/ruby_odata/service.rb:20:in `initialize'
from /Volumes/Data/GIT/projects/mygento/account/app/models/document.rb:5:in `new'
I guess You didn't push release to ruby gems so I use 0.1.0
Let me fix that.
0.1.6 is out there https://rubygems.org/gems/ruby_odata
I see, but my Gemfile is not strict on any version of your gem. I'll try to check
Bundler could not find compatible versions for gem "i18n":
In Gemfile:
rails (~> 4.2) ruby depends on
activejob (= 4.2.0) ruby depends on
activesupport (= 4.2.0) ruby depends on
i18n (~> 0.7) ruby
ruby_odata (= 0.1.6) ruby depends on
i18n (~> 0.6.0) ruby
I don't have any lock on i18n:
s.add_dependency("addressable", ">= 2.3.4")
s.add_dependency("i18n", ">= 0.7.0")
s.add_dependency("activesupport", ">= 3.0.0")
s.add_dependency("rest-client", ">= 1.5.1")
s.add_dependency("nokogiri", ">= 1.4.2")
No, You have https://rubygems.org/gems/ruby_odata
Hmm, that's odd. Let me see if I can fix that.
Released a new version, 0.2.0,beta1
. We changed to Faraday instead of RestClient so I want to make sure people have time to test it out and make sure it doesn't break, hence the beta1
. This will hopefully fix your issue as it worked fine for me.
Great, No errors on connection. In addition can you help me - how to call cyrillic collection (for ex "Catalog_Банки") ?
Great!
Assuming it properly parses the names (which it seems to in my tests), it should just be something like this:
svc = OData::Service.new 'http://95.213.158.5/hamster/odata/standard.odata'
svc.Catalog_Банки
results = svc.execute
puts results.to_json
thanks a lot
Also receive the same error - but when using 0.2.0.beta1 I can progress (another error but more informative).
Using ruby 2.3.0 on osx fwiw
@rkachowski What's the error?
I don't have time to look into it now, but I believe it's an error due to the server not sending the correct data (using artifactory's odata feed) - i.e. it's not an error from the gem
Got exception: undefined method `content' for nil:NilClass