Class: GoogleApi::Ga::Goal

Inherits:
Management show all
Defined in:
lib/google_api/ga/management/goal.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(goal) ⇒ Goal

Returns a new instance of Goal.



13
14
15
# File 'lib/google_api/ga/management/goal.rb', line 13

def initialize(goal)
  set(goal)
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



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

def 
  @account_id
end

#activeObject (readonly)

Returns the value of attribute active.



9
10
11
# File 'lib/google_api/ga/management/goal.rb', line 9

def active
  @active
end

#goalObject (readonly)

Returns the value of attribute goal.



11
12
13
# File 'lib/google_api/ga/management/goal.rb', line 11

def goal
  @goal
end

#profile_idObject (readonly)

Returns the value of attribute profile_id.



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

def profile_id
  @profile_id
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#webproperty_idObject (readonly)

Returns the value of attribute webproperty_id.



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

def webproperty_id
  @webproperty_id
end

Class Method Details

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



17
18
19
# File 'lib/google_api/ga/management/goal.rb', line 17

def self.all( = '~all', webproperty_id = '~all', profile_id = '~all', goal_id = '~all')
  get({ accountId: , webPropertyId: webproperty_id, profileId: profile_id, goalId: goal_id }).map { |goal| Goal.new(goal) }
end

.find(goal_id) ⇒ Object



21
22
23
# File 'lib/google_api/ga/management/goal.rb', line 21

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

Instance Method Details

#profileObject



33
34
35
# File 'lib/google_api/ga/management/goal.rb', line 33

def profile
  @profile ||= Profile.find(@profile_id)
end

#refreshObject



25
26
27
28
29
30
31
# File 'lib/google_api/ga/management/goal.rb', line 25

def refresh
  @profile  = nil

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

  return true
end