Class: Snackhack2::GoogleAnalytics
- Inherits:
-
Object
- Object
- Snackhack2::GoogleAnalytics
- Defined in:
- lib/snackhack2/google_analytics.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize ⇒ GoogleAnalytics
constructor
A new instance of GoogleAnalytics.
- #run ⇒ Object
Constructor Details
#initialize ⇒ GoogleAnalytics
Returns a new instance of GoogleAnalytics.
8 9 10 |
# File 'lib/snackhack2/google_analytics.rb', line 8 def initialize @site = site end |
Instance Attribute Details
#site ⇒ Object
Returns the value of attribute site.
6 7 8 |
# File 'lib/snackhack2/google_analytics.rb', line 6 def site @site end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/snackhack2/google_analytics.rb', line 12 def run a = Snackhack2::get(@site).body case a when /UA-\d{8}-\d/ puts a.match(/UA-\d{8}-\d/) when /GTM-[A-Z0-9]{7}/ puts a.match(/GTM-[A-Z0-9]{7}/) when /G-([0-9]+([A-Za-z]+[0-9]+)+)/ puts a.match(/G-([0-9]+([A-Za-z]+[0-9]+)+)/) when /G-[A-Za-z0-9]+/ puts a.match(/G-[A-Za-z0-9]+/) else puts '[+] No Google Analytics found :(' end end |