Class: Whoa::Page

Inherits:
WoObject show all
Defined in:
lib/whoa/page.rb

Instance Attribute Summary

Attributes inherited from WoObject

#new_record

Instance Method Summary collapse

Methods inherited from WoObject

all, #attributes, #copy!, create, #destroy, first, handle_response, inherited, #initialize, last, #merge_attributes, #new_record?, #save, #update_attributes

Constructor Details

This class inherits a constructor from Whoa::WoObject

Instance Method Details

#experiment_idObject



14
15
16
# File 'lib/whoa/page.rb', line 14

def experiment_id
  @experiment_id ||= (wo_url.to_s.split("experiments/")[1].split("/")[0].to_i if wo_url)
end

#experiment_id=(val) ⇒ Object



18
19
20
# File 'lib/whoa/page.rb', line 18

def experiment_id=(val)
  @experiment_id = val
end

#to_xmlObject



28
29
30
31
32
33
# File 'lib/whoa/page.rb', line 28

def to_xml
  Whoa::Request.build_payload do |xml|
    xml.title title
    xml.content content
  end
end

#urlObject



22
23
24
25
26
# File 'lib/whoa/page.rb', line 22

def url
  str = "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/#{experiment_id}/abpagevariations"   
  str += "/#{variation_id}" unless new_record?
  str
end