Class: Google::Apis::PagespeedonlineV5::PagespeedInsightsService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::PagespeedonlineV5::PagespeedInsightsService
- Defined in:
- lib/google/apis/pagespeedonline_v5/service.rb
Overview
PageSpeed Insights API
The PageSpeed Insights API lets you analyze the performance of your website with a simple API. It offers tailored suggestions for how you can optimize your site, and lets you easily integrate PageSpeed Insights analysis into your development tools and workflow.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://pagespeedonline.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#initialize ⇒ PagespeedInsightsService
constructor
A new instance of PagespeedInsightsService.
-
#runpagespeed_pagespeedapi(url, captcha_token: nil, category: nil, locale: nil, strategy: nil, utm_campaign: nil, utm_source: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PagespeedonlineV5::PagespeedApiPagespeedResponseV5
Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information.
Constructor Details
#initialize ⇒ PagespeedInsightsService
Returns a new instance of PagespeedInsightsService.
50 51 52 53 54 55 |
# File 'lib/google/apis/pagespeedonline_v5/service.rb', line 50 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-pagespeedonline_v5', client_version: Google::Apis::PagespeedonlineV5::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43 44 45 |
# File 'lib/google/apis/pagespeedonline_v5/service.rb', line 43 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48 49 50 |
# File 'lib/google/apis/pagespeedonline_v5/service.rb', line 48 def quota_user @quota_user end |
Instance Method Details
#runpagespeed_pagespeedapi(url, captcha_token: nil, category: nil, locale: nil, strategy: nil, utm_campaign: nil, utm_source: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PagespeedonlineV5::PagespeedApiPagespeedResponseV5
Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/google/apis/pagespeedonline_v5/service.rb', line 92 def runpagespeed_pagespeedapi(url, captcha_token: nil, category: nil, locale: nil, strategy: nil, utm_campaign: nil, utm_source: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'pagespeedonline/v5/runPagespeed', ) command.response_representation = Google::Apis::PagespeedonlineV5::PagespeedApiPagespeedResponseV5::Representation command.response_class = Google::Apis::PagespeedonlineV5::PagespeedApiPagespeedResponseV5 command.query['captchaToken'] = captcha_token unless captcha_token.nil? command.query['category'] = category unless category.nil? command.query['locale'] = locale unless locale.nil? command.query['strategy'] = strategy unless strategy.nil? command.query['url'] = url unless url.nil? command.query['utm_campaign'] = utm_campaign unless utm_campaign.nil? command.query['utm_source'] = utm_source unless utm_source.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |