Sha256: 2b9436d920938281ab37d0408c7e2587f4e60af5d4217329ce659d1b8de9fdc1

Contents?: true

Size: 1023 Bytes

Versions: 8

Compression:

Stored size: 1023 Bytes

Contents

module Garb
  class Profile

    include ProfileReports

    attr_reader :session, :table_id, :title, :account_name, :account_id, :web_property_id, :goals

    def initialize(entry, session)
      @session = session
      @title = entry['title']
      @table_id = entry['dxp:tableId']
      @goals = (entry[Garb.to_ga('goal')] || []).map {|g| Goal.new(g)}

      Garb.parse_properties(entry).each do |k,v|
        instance_variable_set :"@#{k}", v
      end
    end

    def id
      Garb.from_ga(@table_id)
    end

    def self.all(session = Session)
      ActiveSupport::Deprecation.warn("Garb::Profile.all is deprecated in favor of Garb::Management::Profile.all")
      AccountFeedRequest.new(session).entries.map {|entry| new(entry, session)}
    end

    def self.first(id, session = Session)
      ActiveSupport::Deprecation.warn("Garb::Profile.first is deprecated in favor of Garb::Management::WebProperty")
      all(session).detect {|profile| profile.id == id || profile.web_property_id == id }
    end
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
readmedia-garb-0.9.1.1 lib/garb/profile.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/garb-0.9.1/lib/garb/profile.rb
garb-0.9.1 lib/garb/profile.rb
garb-0.9.0 lib/garb/profile.rb
garb-0.8.5 lib/garb/profile.rb
titanous-garb-0.8.5 lib/garb/profile.rb
garb-0.8.4 lib/garb/profile.rb
garb-0.8.3 lib/garb/profile.rb