Class: Hisui::Management::WebProperty
- Defined in:
- lib/hisui/management/web_property.rb
Constant Summary collapse
- GA_ATTRIBUTES =
{ :id => 'id', :name => 'name', :account_id => 'accountId', :website_url => 'websiteUrl' }
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#profiles ⇒ Object
Returns the value of attribute profiles.
-
#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
Instance Method Summary collapse
- #account ⇒ Object
-
#initialize(attributes, user, profiles = nil) ⇒ WebProperty
constructor
A new instance of WebProperty.
- #path ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(attributes, user, profiles = nil) ⇒ WebProperty
Returns a new instance of WebProperty.
14 15 16 17 18 19 20 21 22 |
# File 'lib/hisui/management/web_property.rb', line 14 def initialize(attributes, user, profiles = nil) GA_ATTRIBUTES.each do |key, string_key| self.send("#{key}=", attributes.delete(string_key) || attributes.delete(key)) end @attributes = attributes @user = user @profiles = profiles end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
12 13 14 |
# File 'lib/hisui/management/web_property.rb', line 12 def attributes @attributes end |
#profiles ⇒ Object
Returns the value of attribute profiles.
12 13 14 |
# File 'lib/hisui/management/web_property.rb', line 12 def profiles @profiles end |
#user ⇒ Object
Returns the value of attribute user.
12 13 14 |
# File 'lib/hisui/management/web_property.rb', line 12 def user @user end |
Class Method Details
.build_from_summary(attributes, user) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/hisui/management/web_property.rb', line 29 def build_from_summary(attributes, user) summary_profiles = attributes[:profiles].inject([]) { |summary_profiles, profile| profile[:webPropertyId] = attributes[:id] summary_profiles << Profile.build_from_summary(profile, user) } new(attributes, user, summary_profiles) end |
.default_path ⇒ Object
25 26 27 |
# File 'lib/hisui/management/web_property.rb', line 25 def default_path '/accounts/~all/webproperties' end |
.for_account(account) ⇒ Object
38 39 40 |
# File 'lib/hisui/management/web_property.rb', line 38 def for_account(account) all(account.user, account.path + '/webproperties') end |
Instance Method Details
#account ⇒ Object
51 52 53 |
# File 'lib/hisui/management/web_property.rb', line 51 def account Account.from_child(self) end |
#path ⇒ Object
43 44 45 |
# File 'lib/hisui/management/web_property.rb', line 43 def path "/accounts/#{account_id}/webproperties/#{id}" end |