Tech-Draft

rubyとかscalaとかjavascriptとか?AndroidやiOSもチマチマと。

Garb 0.9.2が動かなくなった

2012/01/12時点で、Garb 0.9.2が動かなくなりました。

Garbのソースは少し古くてGoogle Analytics Data Export API v2.3を前提にしていますが、どうもこの数日でこのv2.3がshutdownされた模様。

2011/12/5のChangeLogをみると、

This release also announces the deprecation of Version 2.3 and the upcoming shut down of the Account Feed in the Data Export API. In 6 months:

Requests to the version 2.3 JSON output will not be supported by the version 2.4 response and will return 404 Not Found status codes. If you need a JSON response, upgrade to Version 3.0.

http://code.google.com/intl/en/apis/analytics/community/export_changelog.html

とあり、6ヶ月の猶予も無くshutdownされた感じです。


実際Garb0.9.2を動かすと、Google Analytics Data Export APIを用いてProfileリストを取得する部分で下記のようなエラーが発生しています。

/usr/local/lib/ruby/gems/1.9.1/gems/garb-0.9.2/lib/garb/request/data.rb:39:in `send_request': "{\"error\":{\"errors\":[{\"domain\":\"global\",\"reason\":\"unsupportedOutputFormat\",\"message\":\"Unsupported Output Format\",\"locationType\":\"parameter\",\"location\":\"alt\"}],\"code\":400,\"message\":\"Unsupported Output Format\"}}" (Garb::Request::Data::ClientError)
	from /usr/local/lib/ruby/gems/1.9.1/gems/garb-0.9.2/lib/garb/management/feed.rb:22:in `response'
	from /usr/local/lib/ruby/gems/1.9.1/gems/garb-0.9.2/lib/garb/management/feed.rb:13:in `parsed_response'
	from /usr/local/lib/ruby/gems/1.9.1/gems/garb-0.9.2/lib/garb/management/feed.rb:18:in `entries'
	from /usr/local/lib/ruby/gems/1.9.1/gems/garb-0.9.2/lib/garb/management/profile.rb:12:in `all'

このエラーは https://www.google.com/analytics/feeds/datasources/ga/accounts/~all/webproperties/~all/profiles?alt=json というリクエストを投げた時にraiseされているので、ChangeLogにあるようにJSONフォーマットによる出力がshutdownされたことが直接原因のようです。

うーん、v3対応を書くかなぁ・・・