Sha256: 37352853cb3ab378c268196851bf734acd8f08953dfa51948cd62f406de91685

Contents?: true

Size: 866 Bytes

Versions: 6

Compression:

Stored size: 866 Bytes

Contents

module Garb
  module Management
    class Account
      attr_reader :session, :path
      attr_reader :id, :title, :name

      def self.all(session = Session)
        feed = Feed.new(session, '/accounts') # builds request and parses response

        feed.entries.map {|entry| new(entry, session)}
      end

      def initialize(entry, session)
        @session = session
        @path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '')
        @title = entry['title'].gsub('Google Analytics Account ', '')

        properties = Garb.parse_properties(entry)
        @id = properties["account_id"]
        @name = properties["account_name"]
      end

      def web_properties
        @web_properties ||= WebProperty.for_account(self) # will call path
      end

      def profiles
        @profiles ||= Profile.for_account(self)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
titanous-garb-0.8.7 lib/garb/management/account.rb
titanous-garb-0.8.5 lib/garb/management/account.rb
garb-0.8.4 lib/garb/management/account.rb
garb-0.8.3 lib/garb/management/account.rb
garb-0.8.2 lib/garb/management/account.rb
garb-0.8.1 lib/garb/management/account.rb