Class: PagespeedInsights::V5
- Inherits:
-
Object
- Object
- PagespeedInsights::V5
- Defined in:
- lib/v5/api_v5.rb
Overview
Wrapper for Pagespeed Insights API version 5
Constant Summary collapse
- PAGESPEED_API_URL =
'https://www.googleapis.com/pagespeedonline/v5/runPagespeed'
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url:, key:, strategy: nil, categories: []) ⇒ V5
constructor
A new instance of V5.
- #results(fields: nil, pretty_print: true) ⇒ Object
Constructor Details
#initialize(url:, key:, strategy: nil, categories: []) ⇒ V5
Returns a new instance of V5.
11 12 13 14 15 16 17 |
# File 'lib/v5/api_v5.rb', line 11 def initialize(url:, key:, strategy: nil, categories: []) @base_url = PAGESPEED_API_URL @url = url @key = key @strategy = strategy @categories = categories end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def body @body end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def categories @categories end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def headers @headers end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def key @key end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def status @status end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def strategy @strategy end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/v5/api_v5.rb', line 9 def url @url end |
Instance Method Details
#results(fields: nil, pretty_print: true) ⇒ Object
19 20 21 22 23 |
# File 'lib/v5/api_v5.rb', line 19 def results(fields: nil, pretty_print: true) parse_categories uri_params = uri_params_generator(fields, pretty_print) make_request(uri_params) end |