Class: GoogleMobileFriendly::TestPage
- Inherits:
-
Object
- Object
- GoogleMobileFriendly::TestPage
- Defined in:
- lib/google_mobile_friendly/test_page.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(api_response) ⇒ TestPage
constructor
A new instance of TestPage.
- #is_mobile_friendly? ⇒ Boolean
- #list_of_blocked_resources ⇒ Object
- #list_of_mobile_issues ⇒ Object
Constructor Details
#initialize(api_response) ⇒ TestPage
Returns a new instance of TestPage.
5 6 7 8 9 |
# File 'lib/google_mobile_friendly/test_page.rb', line 5 def initialize api_response @response = api_response raise @response[:error][:message] unless @response[:error].nil? GoogleMobileFriendly::ResponseData::TestStatus.raise_if_response_is_bad @response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/google_mobile_friendly/test_page.rb', line 3 def response @response end |
Instance Method Details
#is_mobile_friendly? ⇒ Boolean
11 12 13 |
# File 'lib/google_mobile_friendly/test_page.rb', line 11 def is_mobile_friendly? @response[:mobileFriendliness] == GoogleMobileFriendly::ResponseData::RunMobileFriendlyTestResponse.mobile_friendly end |
#list_of_blocked_resources ⇒ Object
19 20 21 |
# File 'lib/google_mobile_friendly/test_page.rb', line 19 def list_of_blocked_resources GoogleMobileFriendly::ResponseData::ResourceIssue.get_blocked_resources_issues_urls @response end |
#list_of_mobile_issues ⇒ Object
15 16 17 |
# File 'lib/google_mobile_friendly/test_page.rb', line 15 def list_of_mobile_issues GoogleMobileFriendly::ResponseData::MobileFriendlyIssue.get_user_friendly_issues @response end |