class Google::SafeBrowsingRedirectUrl

Public Class Methods

url_hash_key(url_str) click to toggle source
# File lib/rails/generators/google/model/templates/google/safe_browsing_redirect_url.rb, line 30
def url_hash_key url_str
  Digest::MD5.hexdigest(url_str)
end

Public Instance Methods

set_download_attr() click to toggle source
# File lib/rails/generators/google/model/templates/google/safe_browsing_redirect_url.rb, line 22
def set_download_attr
  if !self.download_state.blank? && self.download_state != COMPLETED
    self.download_attempts ||= 0
    self.download_attempts += 1
  end
end
set_other_attrs() click to toggle source
# File lib/rails/generators/google/model/templates/google/safe_browsing_redirect_url.rb, line 15
def set_other_attrs
  ord = Google::SafeBrowsingRedirectUrl.maximum(:order)
  self.order = ord.nil?? 1 : ord + 1
  self.url_hash = SafeBrowsingRedirectUrl.url_hash_key(self.url)
  set_download_attr
end