Class: Garb::Profile

Inherits:
Object
  • Object
show all
Includes:
ProfileReports
Defined in:
lib/garb/profile.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ProfileReports

add_report_method

Constructor Details

#initialize(entry, session) ⇒ Profile

Returns a new instance of Profile.



8
9
10
11
12
13
14
15
16
17
# File 'lib/garb/profile.rb', line 8

def initialize(entry, session)
  @session = session
  @title = entry['title']
  @table_id = entry['dxp:tableId']
  @goals = (entry[Garb.to_ga('goal')] || []).map {|g| Goal.new(g)}

  Garb.parse_properties(entry).each do |k,v|
    instance_variable_set :"@#{k}", v
  end
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



6
7
8
# File 'lib/garb/profile.rb', line 6

def 
  @account_id
end

#account_nameObject (readonly)

Returns the value of attribute account_name.



6
7
8
# File 'lib/garb/profile.rb', line 6

def 
  @account_name
end

#goalsObject (readonly)

Returns the value of attribute goals.



6
7
8
# File 'lib/garb/profile.rb', line 6

def goals
  @goals
end

#sessionObject (readonly)

Returns the value of attribute session.



6
7
8
# File 'lib/garb/profile.rb', line 6

def session
  @session
end

#table_idObject (readonly)

Returns the value of attribute table_id.



6
7
8
# File 'lib/garb/profile.rb', line 6

def table_id
  @table_id
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/garb/profile.rb', line 6

def title
  @title
end

#web_property_idObject (readonly)

Returns the value of attribute web_property_id.



6
7
8
# File 'lib/garb/profile.rb', line 6

def web_property_id
  @web_property_id
end

Class Method Details

.all(session = Session) ⇒ Object



23
24
25
26
# File 'lib/garb/profile.rb', line 23

def self.all(session = Session)
  ActiveSupport::Deprecation.warn("Garb::Profile.all is deprecated in favor of Garb::Management::Profile.all")
  AccountFeedRequest.new(session).entries.map {|entry| new(entry, session)}
end

.first(id, session = Session) ⇒ Object



28
29
30
31
# File 'lib/garb/profile.rb', line 28

def self.first(id, session = Session)
  ActiveSupport::Deprecation.warn("Garb::Profile.first is deprecated in favor of Garb::Management::WebProperty")
  all(session).detect {|profile| profile.id == id || profile.web_property_id == id }
end

Instance Method Details

#idObject



19
20
21
# File 'lib/garb/profile.rb', line 19

def id
  Garb.from_ga(@table_id)
end