Created
February 14, 2014 16:57
-
-
Save bmaddy/9004763 to your computer and use it in GitHub Desktop.
debugging ldp/faraday
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.0.0p353 :018 > HOST = 'http://localhost:8080' | |
=> "http://localhost:8080" | |
2.0.0p353 :019 > client = Ldp::Client.new(HOST) | |
=> #<Ldp::Client:0x007f8f9f0c5860 @http=#<Faraday::Connection:0x007f8f9f0c5770 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.0"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007f8f9f0c4938 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTP:0x007f8f9f0c40c8 URL:http://localhost:8080/>, @proxy=nil>> | |
2.0.0p353 :020 > resource = Ldp::Resource.new(client, HOST + '/rest/node/to/update') | |
=> #<Ldp::Resource:0x007f8f9f0e8798 @client=#<Ldp::Client:0x007f8f9f0c5860 @http=#<Faraday::Connection:0x007f8f9f0c5770 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.0"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007f8f9f0c4938 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTP:0x007f8f9f0c40c8 URL:http://localhost:8080/>, @proxy=nil>>, @subject="http://localhost:8080/rest/node/to/update"> | |
2.0.0p353 :021 > orm = Ldp::Orm.new(resource) | |
=> #<Ldp::Orm:0x007f8f9d6a62e0 @resource=#<Ldp::Resource:0x007f8f9f0e8798 @client=#<Ldp::Client:0x007f8f9f0c5860 @http=#<Faraday::Connection:0x007f8f9f0c5770 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.0"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007f8f9f0c4938 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTP:0x007f8f9f0c40c8 URL:http://localhost:8080/>, @proxy=nil>>, @subject="http://localhost:8080/rest/node/to/update">> | |
# Why does this not work? | |
2.0.0p353 :022 > orm.value(RDF::DC11.title) | |
NoMethodError: undefined method `graph' for #<Faraday::Response:0x007f8f9d6c3250> | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353/bundler/gems/ldp-72c1db0d7465/lib/ldp/resource.rb:80:in `graph' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353/bundler/gems/ldp-72c1db0d7465/lib/ldp/orm.rb:11:in `graph' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353/bundler/gems/ldp-72c1db0d7465/lib/ldp/orm.rb:15:in `value' | |
from (irb):22 | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/cli.rb:619:in `console' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/bin/bundle:23:in `load' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353@global/bin/bundle:23:in `<main>' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval' | |
from /Users/bmaddy/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>' | |
# This seems to be the problem: | |
2.0.0p353 :039 > Ldp::Response.links(resource.get)["type"] | |
=> ["http://www.w3.org/ns/ldp/Resource"] | |
2.0.0p353 :040 > Ldp.resource.to_s | |
=> "http://www.w3.org/ns/ldp#Resource" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment