No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for Google AMP Cache API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

google-amp-cache

A simple Ruby API wrapper for Google AMP Cache.

Usage

Create API client using Google API key:

client = Google::AMP::Cache::Client.new MY_GOOGLE_API_KEY, File.read(MY_PRIVATE_KEY)

Update cache

Just simply:

client.update_cache('https://limitless-tundra-65881.herokuapp.com/amp-access/sample/0')

Match URLs to AMP URLs

You can query AMP URLs from Google AMP Cache:

client.batch_get("https://www.theguardian.com/membership/2016/feb/24/todays-release-of-accelerated-mobile-pages-amp")
# => {"ampUrls"=>[{"originalUrl"=>"https://www.theguardian.com/membership/2016/feb/24/todays-release-of-accelerated-mobile-pages-amp", "ampUrl"=>"https://amp.theguardian.com/membership/2016/feb/24/todays-release-of-accelerated-mobile-pages-amp", "cdnAmpUrl"=>"https://amp-theguardian-com.cdn.ampproject.org/c/s/amp.theguardian.com/membership/2016/feb/24/todays-release-of-accelerated-mobile-pages-amp"}]}

Or multiple URLs:

client.batch_get(["URL A", "URL B"])

License

The gem is available as open source under the terms of the MIT License.