Sha256: df6fcf198bcfb46ff61b20c84b8ac68ab3e11718d130abe28186d7fcc06210f0

Contents?: true

Size: 923 Bytes

Versions: 65

Compression:

Stored size: 923 Bytes

Contents

require 'travis/client'

module Travis
  module Client
    class User < Entity
      # @!parse attr_reader :login, :name, :email, :gravatar_id, :locale, :is_syncing, :synced_at, :correct_scopes
      attributes :login, :name, :email, :gravatar_id, :locale, :is_syncing, :synced_at, :correct_scopes, :channels
      inspect_info :login

      one  :user
      many :users

      def synced_at=(time)
        set_attribute(:synced_at, time(time))
      end

      def sync
        session.post_raw('/users/sync')
        reload
      end

      def channels
        load_attribute(:is_syncing) # dummy to trigger load, as channels might not be included
        attributes['channels'] ||= ['common']
      end

      def repositories
        attributes['repositories'] ||= session.get('/users/permissions')['permissions']
      end

      alias syncing? is_syncing
      alias correct_scopes? correct_scopes
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
travis-1.5.4 lib/travis/client/user.rb
travis-1.5.3 lib/travis/client/user.rb
travis-1.5.2 lib/travis/client/user.rb
travis-1.5.1 lib/travis/client/user.rb
travis-1.5.0 lib/travis/client/user.rb