Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `dig' for #<String:0x007fc17bf6a060> #10

Open
abrambailey opened this issue Sep 25, 2017 · 1 comment
Open

Comments

@abrambailey
Copy link

After running @api = WpApiClient.get_client I see the following:

#<WpApiClient::Client:0x007fc17ecd9028 @connection=#<WpApiClient::Connection:0x007fc181aa91d8 @configuration=#<WpApiClient::Configuration:0x007fc17ec994f0 @endpoint="http://www.mysite.com/blog/wp-json/wp/v2", @embed=true>, @queue=[], @conn=#<Faraday::Connection:0x007fc181aa9110 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.12.2"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007fc181aa8da0 @handlers=[Faraday::Response::RaiseError, FaradayMiddleware::ParseJson, Faraday::Adapter::Typhoeus]>, @url_prefix=#<URI::HTTP http://www.mysite.com/blog/wp-json/wp/v2>, @proxy=nil>>>
2.3.3 :009 > posts = @api.get('posts/')
ETHON: Libcurl initialized
ETHON: performed EASY effective_url=http://www.mysite.com/blog/wp-json/wp/v2/posts/?_embed=true response_code=301 return_code=ok total_time=0.195981
NoMethodError: undefined method `dig' for #<String:0x007fc17bf6a060>
@duncanjbrown
Copy link
Owner

Hi @abrambailey. Thanks for reporting. This error looks familiar: it's usually what happens when the WordPress API doesn't return anything. Could probably do with a better error message.

It looks like you're getting a 301 response from your server. Please could you find out where that 301 is pointing, and try to access the API at that address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants