Class: Hisui::Management::WebProperty

Inherits:
Base
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, base_uri

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

#attributesObject

Returns the value of attribute attributes.



12
13
14
# File 'lib/hisui/management/web_property.rb', line 12

def attributes
  @attributes
end

#profilesObject

Returns the value of attribute profiles.



12
13
14
# File 'lib/hisui/management/web_property.rb', line 12

def profiles
  @profiles
end

#userObject

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_pathObject



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 ()
  all(.user, .path + '/webproperties')
end

Instance Method Details

#accountObject



51
52
53
# File 'lib/hisui/management/web_property.rb', line 51

def 
  Account.from_child(self)
end

#pathObject



43
44
45
# File 'lib/hisui/management/web_property.rb', line 43

def path
  "/accounts/#{}/webproperties/#{id}"
end