Class: Hisui::Management::Goal
- Defined in:
- lib/hisui/management/goal.rb
Constant Summary collapse
- GA_ATTRIBUTES =
{ :id => 'id', :name => 'name', :account_id => 'accountId', :web_property_id => 'webPropertyId', :profile_id => 'profileId' }
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
- .default_path ⇒ Object
- .for_account(account) ⇒ Object
- .for_profile(profile) ⇒ Object
- .for_web_property(web_property) ⇒ Object
Instance Method Summary collapse
-
#initialize(attributes, user) ⇒ Goal
constructor
A new instance of Goal.
- #path ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(attributes, user) ⇒ Goal
15 16 17 18 19 20 21 22 |
# File 'lib/hisui/management/goal.rb', line 15 def initialize(attributes, user) GA_ATTRIBUTES.each do |key, string_key| self.send("#{key}=", attributes.delete(string_key) || attributes.delete(key)) end @attributes = attributes @user = user end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
13 14 15 |
# File 'lib/hisui/management/goal.rb', line 13 def attributes @attributes end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/hisui/management/goal.rb', line 13 def user @user end |
Class Method Details
.default_path ⇒ Object
25 26 27 |
# File 'lib/hisui/management/goal.rb', line 25 def default_path '/accounts/~all/webproperties/~all/profiles/~all/goals' end |
.for_account(account) ⇒ Object
29 30 31 |
# File 'lib/hisui/management/goal.rb', line 29 def for_account(account) all(account.user, account.path + '/webproperties/~all/profiles/~all/goals') end |
.for_profile(profile) ⇒ Object
37 38 39 |
# File 'lib/hisui/management/goal.rb', line 37 def for_profile(profile) all(profile.user, profile.path + '/goals') end |
.for_web_property(web_property) ⇒ Object
33 34 35 |
# File 'lib/hisui/management/goal.rb', line 33 def for_web_property(web_property) all(web_property.user, web_property.path + '/profiles/~all/goals') end |
Instance Method Details
#path ⇒ Object
42 43 44 |
# File 'lib/hisui/management/goal.rb', line 42 def path self.class.default_path + '/' + id.to_s end |