UP-nxt / cmis-ruby

Ruby client for CMIS
Apache License 2.0
19 stars 12 forks source link

Should execute return XML string? #19

Closed sashman closed 8 years ago

sashman commented 8 years ago

Hello I am making a connection with my server and trying to get back a list of repositories. Getting this error:

NoMethodError: undefined method `values' for #<String:0x5490bd0>

Looking into server.rb code there is this:

    def repositories(opts = {})
      result = execute!({}, opts)

      result.values.map do |r|
        Repository.new(r, self)
      end
    end

execute just returns the response body? Should this not get parsed somewhere? Or am I using this in a wrong way?

kennethgeerts commented 8 years ago

Thanks for the report. I'll look into it. Can you paste a full trace of the error? And the piece of calling code that produces it. For context, what CMIS server are you running against?

sashman commented 8 years ago

This is all I'm getting:

CMIS::Server[http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom]
rake aborted!
NoMethodError: undefined method `values' for #<String:0x6526cb0>
....rake:45:in `block (2 levels) in <top (required)>'
-e:1:in `load'
-e:1:in `<main>'
Tasks: TOP => alfresco:read_folders
(See full trace by running task with --trace)

Here is my task:

    server = CMIS::Server.new(service_url: 'http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom', username: 'admin', password: 'password')
    puts server.inspect
    puts server.repositories.inspect

Could this be due to me using an atom API? (Using Alfresco as you can tell from the URL)

kennethgeerts commented 8 years ago

Could this be due to me using an atom API?

Yep. cmis-ruby talks to the browser binding only. I'll try to improve the error message though. Thanks!

sashman commented 8 years ago

Awesome cheers!

For the record I should have used this browser end point http://localhost:8080/alfresco/cmisbrowser

kylefernandadams commented 8 years ago

@sashman One point of clarification. If you're using Alfresco 5.x, the correct browser binding uri is the following: http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser

sashman commented 8 years ago

thanks @kylefernandadams!