Sha256: 4a09c6254dc8544fdaf69db5c6726ab1ca67cb0ca73769f4413ec42349149ff1

Contents?: true

Size: 1.36 KB

Versions: 10

Compression:

Stored size: 1.36 KB

Contents

module Gitea
  module Api
    class Client 

      # 构造Api client,用于操作Api数据
      # @param opts [Hash] 构造client时的参数选项
      # @option opts [string] domain [必填] gitea服务地址
      # @option opts [string] base_url [必填] api相对路径
      # @option opts [string] admin_username [必填] 管理员账号
      # @option opts [string] admin_password [必填] 管理员密码
      # @option opts [string] username [选填] 用户账号
      # @option opts [string] password [选填] 用户密码
      # @option opts [string] gitea_token [选填] 用户token
      def initialize(opts)
        @config = Config.new(opts)
        @http = Http.new(@config)
      end

      def config 
        @config
      end

      def config=(config)
        unless config.is_a?(Gitea::Api::Config)
          fail Exception, "load config failure!"
        end
        @config = config
        @http = Http.new(config)
      end

      def token 
        @config.token 
      end

      def token=(token)
        @config.token = token 
      end

      include Gitea::Api::Issue
      include Gitea::Api::Repository
      include Gitea::Api::Settings
      include Gitea::Api::User
      include Gitea::Api::Organization
      include Gitea::Api::Notification
      include Gitea::Api::Miscellaneous
      include Gitea::Api::Admin
    end
  end # User
end # Gitea

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gitea-client-1.1.0 lib/gitea/api/client.rb
gitea-client-1.0.0 lib/gitea/api/client.rb
gitea-client-0.11.0 lib/gitea/api/client.rb
gitea-client-0.10.0 lib/gitea/api/client.rb
gitea-client-0.9.0 lib/gitea/api/client.rb
gitea-client-0.8.0 lib/gitea/api/client.rb
gitea-client-0.7.0 lib/gitea/api/client.rb
gitea-client-0.6.0 lib/gitea/api/client.rb
gitea-client-0.5.0 lib/gitea/api/client.rb
gitea-client-0.4.0 lib/gitea/api/client.rb