Class: Gitea::Api::Http
Constant Summary
collapse
- DEFAULT_CONTENT_TYPE =
'application/json'
'Authorization'
- OPEN_TIMEOUT =
10
- READ_TIMEOUT =
120
Common::Logging::MAX_NUM_LOG, Common::Logging::ROTATE_SIZE
Instance Method Summary
collapse
-
#delete(api_url = '', http_options = {}, &block) ⇒ Object
-
#get(api_url = '', http_options = {}, &block) ⇒ Object
-
#get_request_url(api_url) ⇒ Object
-
#head(api_url = '', http_options = {}, &block) ⇒ Object
-
#initialize(config) ⇒ Http
constructor
-
#options(api_url = '', http_options = {}, &block) ⇒ Object
-
#patch(api_url = '', http_options = {}, &block) ⇒ Object
-
#post(api_url = '', http_options = {}, &block) ⇒ Object
-
#put(api_url = '', http_options = {}, &block) ⇒ Object
#logger, set_log_file, set_log_level
Constructor Details
#initialize(config) ⇒ Http
Returns a new instance of Http.
14
15
16
|
# File 'lib/gitea/api/http.rb', line 14
def initialize(config)
@config = config
end
|
Instance Method Details
#delete(api_url = '', http_options = {}, &block) ⇒ Object
41
42
43
|
# File 'lib/gitea/api/http.rb', line 41
def delete(api_url = '', http_options = {}, &block)
do_request('DELETE', api_url, http_options, &block)
end
|
#get(api_url = '', http_options = {}, &block) ⇒ Object
25
26
27
|
# File 'lib/gitea/api/http.rb', line 25
def get(api_url = '', http_options = {}, &block)
do_request('GET', api_url, http_options, &block)
end
|
#get_request_url(api_url) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/gitea/api/http.rb', line 18
def get_request_url(api_url)
url = @config.domain.dup
url.query = nil
url.fragment = nil
[url.to_s, @config.base_url, api_url].join('')
end
|
#head(api_url = '', http_options = {}, &block) ⇒ Object
45
46
47
|
# File 'lib/gitea/api/http.rb', line 45
def head(api_url = '', http_options = {}, &block)
do_request('HEAD', api_url, http_options, &block)
end
|
#options(api_url = '', http_options = {}, &block) ⇒ Object
49
50
51
|
# File 'lib/gitea/api/http.rb', line 49
def options(api_url = '', http_options = {}, &block)
do_request('OPTIONS', api_url, http_options, &block)
end
|
#patch(api_url = '', http_options = {}, &block) ⇒ Object
33
34
35
|
# File 'lib/gitea/api/http.rb', line 33
def patch(api_url = '', http_options = {}, &block)
do_request('PATCH', api_url, http_options, &block)
end
|
#post(api_url = '', http_options = {}, &block) ⇒ Object
37
38
39
|
# File 'lib/gitea/api/http.rb', line 37
def post(api_url = '', http_options = {}, &block)
do_request('POST', api_url, http_options, &block)
end
|
#put(api_url = '', http_options = {}, &block) ⇒ Object
29
30
31
|
# File 'lib/gitea/api/http.rb', line 29
def put(api_url = '', http_options = {}, &block)
do_request('PUT', api_url, http_options, &block)
end
|