Class: SemaphoreClient::HttpClient

Inherits:
Object
  • Object
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) ⇒ HttpClient

Returns a new instance of HttpClient.



7
8
9
10
11
# File 'lib/semaphore_client/http_client.rb', line 7

def initialize(auth_token, api_url, api_version)
  @auth_token = auth_token
  @api_url = api_url
  @api_version = api_version
end

Instance Method Details

#delete(route_elements) ⇒ Object



39
40
41
42
43
# File 'lib/semaphore_client/http_client.rb', line 39

def delete(route_elements)
  route = route(route_elements)

  connection.delete(route)
end

#get(route_elements) ⇒ Object



13
14
15
16
17
# File 'lib/semaphore_client/http_client.rb', line 13

def get(route_elements)
  route = route(route_elements)

  connection.get(route)
end

#patch(route_elements, content = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/semaphore_client/http_client.rb', line 29

def patch(route_elements, content = nil)
  route = route(route_elements)

  if content
    connection.patch(route, content)
  else
    connection.patch(route)
  end
end

#post(route_elements, content = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/semaphore_client/http_client.rb', line 19

def post(route_elements, content = nil)
  route = route(route_elements)

  if content
    connection.post(route, content)
  else
    connection.post(route)
  end
end