Class: Gitea::Api::Hat::Http
- Inherits:
-
Object
- Object
- Gitea::Api::Hat::Http
show all
- Includes:
- Common::Logging
- Defined in:
- lib/gitea/api/hat/http.rb
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/hat/http.rb', line 14
def initialize(config)
@config = config
end
|
Instance Method Details
#delete(api_url = '', http_options = {}, &block) ⇒ Object
43
44
45
|
# File 'lib/gitea/api/hat/http.rb', line 43
def delete(api_url = '', http_options = {}, &block)
do_request('DELETE', api_url, http_options, &block)
end
|
#get(api_url = '', http_options = {}, &block) ⇒ Object
27
28
29
|
# File 'lib/gitea/api/hat/http.rb', line 27
def get(api_url = '', http_options = {}, &block)
do_request('GET', api_url, http_options, &block)
end
|
#get_request_url(api_url) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/gitea/api/hat/http.rb', line 20
def get_request_url(api_url)
url = @config.domain.dup
url.query = nil
url.fragment = nil
[url.to_s, @config.hat_base_url, api_url].join('')
end
|
#head(api_url = '', http_options = {}, &block) ⇒ Object
47
48
49
|
# File 'lib/gitea/api/hat/http.rb', line 47
def head(api_url = '', http_options = {}, &block)
do_request('HEAD', api_url, http_options, &block)
end
|
#options(api_url = '', http_options = {}, &block) ⇒ Object
51
52
53
|
# File 'lib/gitea/api/hat/http.rb', line 51
def options(api_url = '', http_options = {}, &block)
do_request('OPTIONS', api_url, http_options, &block)
end
|
#patch(api_url = '', http_options = {}, &block) ⇒ Object
35
36
37
|
# File 'lib/gitea/api/hat/http.rb', line 35
def patch(api_url = '', http_options = {}, &block)
do_request('PATCH', api_url, http_options, &block)
end
|
#post(api_url = '', http_options = {}, &block) ⇒ Object
39
40
41
|
# File 'lib/gitea/api/hat/http.rb', line 39
def post(api_url = '', http_options = {}, &block)
do_request('POST', api_url, http_options, &block)
end
|
#put(api_url = '', http_options = {}, &block) ⇒ Object
31
32
33
|
# File 'lib/gitea/api/hat/http.rb', line 31
def put(api_url = '', http_options = {}, &block)
do_request('PUT', api_url, http_options, &block)
end
|