Class: Crawlscope::StructuredData::Audit::Entry

Inherits:
Data
  • Object
show all
Defined in:
lib/crawlscope/structured_data/audit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type

Returns:

  • (Object)

    the current value of content_type



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def content_type
  @content_type
end

#errorsObject (readonly)

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def errors
  @errors
end

#fetch_errorObject (readonly)

Returns the value of attribute fetch_error

Returns:

  • (Object)

    the current value of fetch_error



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def fetch_error
  @fetch_error
end

#skipped_reasonObject (readonly)

Returns the value of attribute skipped_reason

Returns:

  • (Object)

    the current value of skipped_reason



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def skipped_reason
  @skipped_reason
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def status
  @status
end

#structured_itemsObject (readonly)

Returns the value of attribute structured_items

Returns:

  • (Object)

    the current value of structured_items



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def structured_items
  @structured_items
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



6
7
8
# File 'lib/crawlscope/structured_data/audit.rb', line 6

def url
  @url
end

Instance Method Details

#json_ld_countObject



7
8
9
# File 'lib/crawlscope/structured_data/audit.rb', line 7

def json_ld_count
  structured_items.count { |item| item[:source] == "json-ld" }
end

#microdata_countObject



11
12
13
# File 'lib/crawlscope/structured_data/audit.rb', line 11

def microdata_count
  structured_items.count { |item| item[:source] == "microdata" }
end

#ok?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/crawlscope/structured_data/audit.rb', line 15

def ok?
  fetch_error.nil? && errors.empty?
end

#structured_data_found?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/crawlscope/structured_data/audit.rb', line 19

def structured_data_found?
  skipped_reason == "non-html" || structured_items.any?
end