{"action":"created","issue":{"url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/56","labels_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/56/comments","events_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/56/events","html_url":"https://github.com/contentful/contentful-management.rb/issues/56","id":59549065,"number":56,"title":"\"NoMethodError: undefined method `version=' for nil:NilClass\" after `Contentful::Management::Space.all`","user":{"login":"samme","id":435681,"avatar_url":"https://avatars.githubusercontent.com/u/435681?v=3","gravatar_id":"","url":"https://api.github.com/users/samme","html_url":"https://github.com/samme","followers_url":"https://api.github.com/users/samme/followers","following_url":"https://api.github.com/users/samme/following{/other_user}","gists_url":"https://api.github.com/users/samme/gists{/gist_id}","starred_url":"https://api.github.com/users/samme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samme/subscriptions","organizations_url":"https://api.github.com/users/samme/orgs","repos_url":"https://api.github.com/users/samme/repos","events_url":"https://api.github.com/users/samme/events{/privacy}","received_events_url":"https://api.github.com/users/samme/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"pxlpnk","id":164718,"avatar_url":"https://avatars.githubusercontent.com/u/164718?v=3","gravatar_id":"","url":"https://api.github.com/users/pxlpnk","html_url":"https://github.com/pxlpnk","followers_url":"https://api.github.com/users/pxlpnk/followers","following_url":"https://api.github.com/users/pxlpnk/following{/other_user}","gists_url":"https://api.github.com/users/pxlpnk/gists{/gist_id}","starred_url":"https://api.github.com/users/pxlpnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pxlpnk/subscriptions","organizations_url":"https://api.github.com/users/pxlpnk/orgs","repos_url":"https://api.github.com/users/pxlpnk/repos","events_url":"https://api.github.com/users/pxlpnk/events{/privacy}","received_events_url":"https://api.github.com/users/pxlpnk/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-03-02T20:57:16Z","updated_at":"2015-03-02T22:12:35Z","closed_at":null,"body":"~~~\r\n> Contentful::Management::Space.all\r\nNoMethodError: undefined method `version=' for nil:NilClass\r\n\tfrom /Library/Ruby/Gems/2.0.0/gems/contentful-management-0.6.1/lib/contentful/management/request.rb:13:in `initialize'\r\n\tfrom /Library/Ruby/Gems/2.0.0/gems/contentful-management-0.6.1/lib/contentful/management/space.rb:29:in `new'\r\n\tfrom /Library/Ruby/Gems/2.0.0/gems/contentful-management-0.6.1/lib/contentful/management/space.rb:29:in `all'\r\n~~~"},"comment":{"url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/comments/76837895","html_url":"https://github.com/contentful/contentful-management.rb/issues/56#issuecomment-76837895","issue_url":"https://api.github.com/repos/contentful/contentful-management.rb/issues/56","id":76837895,"user":{"login":"samme","id":435681,"avatar_url":"https://avatars.githubusercontent.com/u/435681?v=3","gravatar_id":"","url":"https://api.github.com/users/samme","html_url":"https://github.com/samme","followers_url":"https://api.github.com/users/samme/followers","following_url":"https://api.github.com/users/samme/following{/other_user}","gists_url":"https://api.github.com/users/samme/gists{/gist_id}","starred_url":"https://api.github.com/users/samme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samme/subscriptions","organizations_url":"https://api.github.com/users/samme/orgs","repos_url":"https://api.github.com/users/samme/repos","events_url":"https://api.github.com/users/samme/events{/privacy}","received_events_url":"https://api.github.com/users/samme/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T22:12:35Z","updated_at":"2015-03-02T22:12:35Z","body":"```ruby\r\n@manage = Contentful::Management::Client.new \"[access token]\"\r\n\r\n# later:\r\n\r\ndef manage_space\r\n  Contentful::Management::Space.find \"[space id]\"\r\nend\r\n```\r\n\r\nI think I fixed it by moving the initialization inside the helper:\r\n\r\n```ruby\r\ndef manage_space\r\n  @manage ||= Contentful::Management::Client.new \"[access token]\", raise_errors: true\r\n  Contentful::Management::Space.find \"[space id]\"\r\nend\r\n```"}}