Class: Hisui::Management::Profile
- Defined in:
- lib/hisui/management/profile.rb
Constant Summary collapse
- GA_ATTRIBUTES =
{ :id => 'id', :name => 'name', :account_id => 'accountId', :web_property_id => 'webPropertyId' }
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
- .build_from_summary(attributes, user) ⇒ Object
- .default_path ⇒ Object
- .for_account(account) ⇒ Object
- .for_web_property(web_property) ⇒ Object
Instance Method Summary collapse
-
#goals ⇒ Object
XXX: Only use ‘user.profiles.#profile.goals Cannot use `web_properties.#web_property.profiles.#profile.goals.
-
#initialize(attributes, user) ⇒ Profile
constructor
A new instance of Profile.
- #path ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(attributes, user) ⇒ Profile
Returns a new instance of Profile.
14 15 16 17 18 19 20 21 |
# File 'lib/hisui/management/profile.rb', line 14 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.
12 13 14 |
# File 'lib/hisui/management/profile.rb', line 12 def attributes @attributes end |
#user ⇒ Object
Returns the value of attribute user.
12 13 14 |
# File 'lib/hisui/management/profile.rb', line 12 def user @user end |
Class Method Details
.build_from_summary(attributes, user) ⇒ Object
28 29 30 |
# File 'lib/hisui/management/profile.rb', line 28 def build_from_summary(attributes, user) Profile.new(attributes, user) end |
.default_path ⇒ Object
24 25 26 |
# File 'lib/hisui/management/profile.rb', line 24 def default_path '/accounts/~all/webproperties/~all/profiles' end |
.for_account(account) ⇒ Object
32 33 34 |
# File 'lib/hisui/management/profile.rb', line 32 def for_account(account) all(account.user, account.path + '/webproperties/~all/profiles') end |
.for_web_property(web_property) ⇒ Object
36 37 38 |
# File 'lib/hisui/management/profile.rb', line 36 def for_web_property(web_property) all(web_property.user, web_property.path + '/profiles') end |
Instance Method Details
#goals ⇒ Object
XXX: Only use ‘user.profiles.#profile.goals
Cannot use `web_properties.#{web_property}.profiles.#{profile}.goals
47 48 49 |
# File 'lib/hisui/management/profile.rb', line 47 def goals Goal.for_profile(self) end |
#path ⇒ Object
41 42 43 |
# File 'lib/hisui/management/profile.rb', line 41 def path "/accounts/#{account_id}/webproperties/#{web_property_id}/profiles/#{id}" end |