diff --git a/lib/gitea/api/client.rb b/lib/gitea/api/client.rb index 8c06725..f6af8a8 100644 --- a/lib/gitea/api/client.rb +++ b/lib/gitea/api/client.rb @@ -16,6 +16,26 @@ module Gitea @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 diff --git a/lib/gitea/common/struct.rb b/lib/gitea/common/struct.rb index aeaed10..301dd4c 100644 --- a/lib/gitea/common/struct.rb +++ b/lib/gitea/common/struct.rb @@ -5,7 +5,7 @@ module Gitea module AttrHelper def attrs(*s) define_method(:attrs) {s} - attr_reader(*s) + attr_accessor(*s) end end