Class: Regiment::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/regiment/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(endpoint) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/regiment/client.rb', line 7

def initialize(endpoint)
  combined = endpoint.split(":")
  @host = combined[0]
  @port = combined[1].to_i
end

Instance Method Details

#about(order, options = {}) ⇒ Object



25
26
27
# File 'lib/regiment/client.rb', line 25

def about(order, options={})
  return RestClient.get(build_uri("/about/#{order}"))
end

#build_uri(path) ⇒ Object



13
14
15
# File 'lib/regiment/client.rb', line 13

def build_uri(path)
  return URI::HTTP.build({:host => @host, :port => @port, :path => path}).to_s
end

#execute(order, options = {}) ⇒ Object



21
22
23
# File 'lib/regiment/client.rb', line 21

def execute(order, options={})
  return RestClient.get(build_uri("/execute/#{order}"))
end

#versionObject



17
18
19
# File 'lib/regiment/client.rb', line 17

def version
  return RestClient.get(build_uri("/version"))
end