Class: GoogleMobileFriendly::TestPage

Inherits:
Object
  • Object
show all
Defined in:
lib/google_mobile_friendly/test_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject (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

Returns:

  • (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_resourcesObject



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_issuesObject



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