Class: GoogleApi::Ga::Profile

Inherits:
Management show all
Defined in:
lib/google_api/ga/management/profile.rb

Instance Attribute Summary collapse

Attributes inherited from Management

#created, #id, #name, #updated

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Management

#camelize

Constructor Details

#initialize(profile) ⇒ Profile

Returns a new instance of Profile.



10
11
12
# File 'lib/google_api/ga/management/profile.rb', line 10

def initialize(profile)
  set(profile)
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



5
6
7
# File 'lib/google_api/ga/management/profile.rb', line 5

def 
  @account_id
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/google_api/ga/management/profile.rb', line 7

def currency
  @currency
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



8
9
10
# File 'lib/google_api/ga/management/profile.rb', line 8

def timezone
  @timezone
end

#webproperty_idObject (readonly)

Returns the value of attribute webproperty_id.



6
7
8
# File 'lib/google_api/ga/management/profile.rb', line 6

def webproperty_id
  @webproperty_id
end

Class Method Details

.all(account_id = '~all', webproperty_id = '~all', profile_id = '~all') ⇒ Object



14
15
16
# File 'lib/google_api/ga/management/profile.rb', line 14

def self.all( = '~all', webproperty_id = '~all', profile_id = '~all')
  get({ accountId: , webPropertyId: webproperty_id, profileId: '~all' }).map { |profile| Profile.new(profile) }
end

.find(profile_id) ⇒ Object



18
19
20
# File 'lib/google_api/ga/management/profile.rb', line 18

def self.find(profile_id)
  all('~all', '~all', profile_id).first
end

Instance Method Details

#goalsObject



35
36
37
# File 'lib/google_api/ga/management/profile.rb', line 35

def goals
  @goals ||= Goal.all(@account_id, @webproperty_id, @id)
end

#refreshObject



22
23
24
25
26
27
28
29
# File 'lib/google_api/ga/management/profile.rb', line 22

def refresh
  @webproperty = nil
  @goals       = nil

  set( Profile.get({ accountId: @account_id, webPropertyId: @webproperty_id, profileId: @id }).first )

  return true
end

#webpropertyObject



31
32
33
# File 'lib/google_api/ga/management/profile.rb', line 31

def webproperty
  @webproperty ||= Webproperty.find(@webproperty_id)
end