Sha256: 60dfdfa3ac28ea80a8ed05ccc64cd6a413ec4ed1fe171e4f49f7d7bd5d3c4bdd

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module Legato
  module Management
    class Profile

      extend Finder
      include ProfileMethods

      def self.default_path
        "/accounts/~all/webproperties/~all/profiles"
      end

      def path
        "/accounts/#{account_id}/webproperties/#{web_property_id}/profiles/#{id}"
      end

      attr_accessor :id, :name, :web_property_id, :account_id, :user, :attributes

      def initialize(attributes, user)
        self.user = user
        self.id = attributes['id']
        self.name = attributes['name']
        self.account_id = attributes['accountId']
        self.web_property_id = attributes['webPropertyId']

        ['id', 'name', 'accountId', 'webPropertyId'].each { |key| attributes.delete(key) }
        self.attributes = attributes
      end

      def self.for_account(account)
        all(account.user, account.path+'/webproperties/~all/profiles')
      end

      def self.for_web_property(web_property)
        all(web_property.user, web_property.path+'/profiles')
      end

      def goals
        Goal.for_profile(self)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
legato-0.3.3 lib/legato/management/profile.rb
legato-0.3.2 lib/legato/management/profile.rb
legato-0.3.1 lib/legato/management/profile.rb
legato-0.3.0 lib/legato/management/profile.rb