Class: SemaphoreClient::HttpClient
- Inherits:
-
Object
- Object
- SemaphoreClient::HttpClient
show all
- Defined in:
- lib/semaphore_client/http_client.rb
Defined Under Namespace
Classes: RouteNotSupported
Instance Method Summary
collapse
Constructor Details
#initialize(auth_token, api_url, api_version, verbose, logger) ⇒ HttpClient
Returns a new instance of HttpClient.
5
6
7
8
9
10
11
|
# File 'lib/semaphore_client/http_client.rb', line 5
def initialize(auth_token, api_url, api_version, verbose, logger)
@auth_token = auth_token
@api_url = api_url
@api_version = api_version
@verbose = verbose
@logger = logger
end
|
Instance Method Details
#delete(route_elements) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/semaphore_client/http_client.rb', line 49
def delete(route_elements)
route = route(route_elements)
trace("DELETE", route) do
connection.delete(route)
end
end
|
#get(route_elements) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/semaphore_client/http_client.rb', line 13
def get(route_elements)
route = route(route_elements)
trace("GET", route) do
connection.get(route)
end
end
|
#patch(route_elements, content = nil) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/semaphore_client/http_client.rb', line 35
def patch(route_elements, content = nil)
route = route(route_elements)
if content
trace("PATCH", route, content) do
connection.patch(route, content)
end
else
trace("PATCH", route) do
connection.patch(route)
end
end
end
|
#post(route_elements, content = nil) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/semaphore_client/http_client.rb', line 21
def post(route_elements, content = nil)
route = route(route_elements)
if content
trace("POST", route, content) do
connection.post(route, content)
end
else
trace("POST", route) do
connection.post(route)
end
end
end
|