Class: Google::SafeBrowsingUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/generators/google/model/templates/google/safe_browsing_update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_listObject

Returns the value of attribute current_list.



25
26
27
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 25

def current_list
  @current_list
end

#listsObject (readonly)

Returns the value of attribute lists.



24
25
26
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 24

def lists
  @lists
end

#nextObject

BODY = [(REKEY | MAC) LF] NEXT LF (RESET | (LIST LF)+) EOF NEXT = “n:” DIGIT+ # Minimum delay before polling again in seconds REKEY = “e:pleaserekey” RESET = “r:pleasereset” LIST = “i:” LISTNAME [MAC] (LF LISTDATA)+ LISTNAME = (LOALPHA | DIGIT | “-”)+ # e.g. “goog-phish-sha128” MAC = “,” (LOALPHA | DIGIT)+ LISTDATA = ((REDIRECT_URL | ADDDEL-HEAD | SUBDEL-HEAD) LF)+ REDIRECT_URL = “u:” URL [MAC] URL = Defined in RFC 1738 ADDDEL-HEAD = “ad:” CHUNKLIST SUBDEL-HEAD = “sd:” CHUNKLIST CHUNKLIST = (RANGE | NUMBER) [“,” CHUNKLIST] NUMBER = DIGIT+ # Chunk number >= 1 RANGE = NUMBER “-” NUMBER



23
24
25
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 23

def next
  @next
end

#rekeyObject

BODY = [(REKEY | MAC) LF] NEXT LF (RESET | (LIST LF)+) EOF NEXT = “n:” DIGIT+ # Minimum delay before polling again in seconds REKEY = “e:pleaserekey” RESET = “r:pleasereset” LIST = “i:” LISTNAME [MAC] (LF LISTDATA)+ LISTNAME = (LOALPHA | DIGIT | “-”)+ # e.g. “goog-phish-sha128” MAC = “,” (LOALPHA | DIGIT)+ LISTDATA = ((REDIRECT_URL | ADDDEL-HEAD | SUBDEL-HEAD) LF)+ REDIRECT_URL = “u:” URL [MAC] URL = Defined in RFC 1738 ADDDEL-HEAD = “ad:” CHUNKLIST SUBDEL-HEAD = “sd:” CHUNKLIST CHUNKLIST = (RANGE | NUMBER) [“,” CHUNKLIST] NUMBER = DIGIT+ # Chunk number >= 1 RANGE = NUMBER “-” NUMBER



23
24
25
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 23

def rekey
  @rekey
end

#resetObject

BODY = [(REKEY | MAC) LF] NEXT LF (RESET | (LIST LF)+) EOF NEXT = “n:” DIGIT+ # Minimum delay before polling again in seconds REKEY = “e:pleaserekey” RESET = “r:pleasereset” LIST = “i:” LISTNAME [MAC] (LF LISTDATA)+ LISTNAME = (LOALPHA | DIGIT | “-”)+ # e.g. “goog-phish-sha128” MAC = “,” (LOALPHA | DIGIT)+ LISTDATA = ((REDIRECT_URL | ADDDEL-HEAD | SUBDEL-HEAD) LF)+ REDIRECT_URL = “u:” URL [MAC] URL = Defined in RFC 1738 ADDDEL-HEAD = “ad:” CHUNKLIST SUBDEL-HEAD = “sd:” CHUNKLIST CHUNKLIST = (RANGE | NUMBER) [“,” CHUNKLIST] NUMBER = DIGIT+ # Chunk number >= 1 RANGE = NUMBER “-” NUMBER



23
24
25
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 23

def reset
  @reset
end

Instance Method Details

#get_ad_chunk_ids(list_name) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 57

def get_ad_chunk_ids list_name
  name = list_name.to_s.to_sym
  if @lists && @lists[name] && !@lists[name][:ad].blank?
    @lists[name][:ad]
  else
    []
  end
end

#get_current_listObject



44
45
46
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 44

def get_current_list
  @lists[current_list]
end

#get_list(list_name) ⇒ Object



40
41
42
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 40

def get_list list_name
  @lists[list_name.to_s.to_sym]
end

#get_redirect_urls(list_name) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 48

def get_redirect_urls list_name
  name = list_name.to_s.to_sym
  if @lists && @lists[name] && !@lists[name][:u].blank?
    @lists[name][:u]
  else
    []
  end
end

#get_sd_chunk_ids(list_name) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 66

def get_sd_chunk_ids list_name
  name = list_name.to_s.to_sym
  if @lists && @lists[name] && !@lists[name][:sd].blank?
    @lists[name][:sd]
  else
    []
  end
end

#has_lists?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 36

def has_lists?
  @lists != nil
end

#set_current_list(list_name) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/rails/generators/google/model/templates/google/safe_browsing_update.rb', line 27

def set_current_list list_name
  @current_list = list_name.to_s.to_sym
  @lists ||= {}
  # :u is download urls
  # :sd is sub del
  # :ad is add del
  @lists[current_list] ||= { :u => [], :sd => [], :ad => [] }
end