Sha256: befaddacf61bceb4e5c6d4cec1a94f3d2e29313e3981fb73f093c1c58ab1a944

Contents?: true

Size: 464 Bytes

Versions: 9

Compression:

Stored size: 464 Bytes

Contents

module Garb
  class Account
    attr_reader :id, :name, :profiles

    def initialize(profiles)
      @id = profiles.first.account_id    
      @name = profiles.first.account_name
      @profiles = profiles
    end

    def self.all(session = Session)
      profiles = {}

      Profile.all(session).each do |profile|
        (profiles[profile.account_id] ||= []) << profile
      end

      profiles.map {|k,v| v}.map {|profiles| new(profiles)}
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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