Class: Regiment::Client
- Inherits:
-
Object
- Object
- Regiment::Client
- Defined in:
- lib/regiment/client.rb
Instance Method Summary collapse
- #about(order, options = {}) ⇒ Object
- #build_uri(path) ⇒ Object
- #execute(order, options = {}) ⇒ Object
-
#initialize(endpoint) ⇒ Client
constructor
A new instance of Client.
- #version ⇒ Object
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, ={}) 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, ={}) return RestClient.get(build_uri("/execute/#{order}")) end |
#version ⇒ Object
17 18 19 |
# File 'lib/regiment/client.rb', line 17 def version return RestClient.get(build_uri("/version")) end |