If GA has no results for the account/profile/web property the response J...

...SON does not include the 'items' key. In this situation you end up with:

NoMethodError: undefined method `map' for nil:NilClass