Module: Anmo
- Defined in:
- lib/anmo.rb,
lib/anmo/version.rb,
lib/anmo/application.rb
Defined Under Namespace
Classes: Application, ApplicationDataStore
Constant Summary
collapse
- VERSION =
"0.0.30"
Class Method Summary
collapse
Class Method Details
.create_request(options) ⇒ Object
25
26
27
|
# File 'lib/anmo.rb', line 25
def self.create_request options
HTTParty.post(anmo_url("__CREATE_OBJECT__"), {:body => options.to_json, :headers => {"Content-Type" => "application/json"}})
end
|
.delete_all ⇒ Object
29
30
31
|
# File 'lib/anmo.rb', line 29
def self.delete_all
HTTParty.post(anmo_url("__DELETE_ALL_OBJECTS__"))
end
|
.delete_all_requests ⇒ Object
38
39
40
|
# File 'lib/anmo.rb', line 38
def self.delete_all_requests
HTTParty.post(anmo_url("__DELETE_ALL_REQUESTS__"))
end
|
.launch_server(port = 8787) ⇒ Object
20
21
22
23
|
# File 'lib/anmo.rb', line 20
def self.launch_server port = 8787
@port = port
Thin::Server.start("0.0.0.0", port, Anmo::Application.new)
end
|
.requests ⇒ Object
33
34
35
36
|
# File 'lib/anmo.rb', line 33
def self.requests
json = HTTParty.get(anmo_url("__REQUESTS__"))
JSON.parse(json.body)
end
|
.running? ⇒ Boolean
47
48
49
|
# File 'lib/anmo.rb', line 47
def self.running?
HTTParty.get(anmo_url("__ALIVE__")).code == 200 rescue false
end
|
.server ⇒ Object
8
9
10
|
# File 'lib/anmo.rb', line 8
def self.server
@server ||= "http://localhost:#{@port}"
end
|
.server=(server) ⇒ Object
12
13
14
|
# File 'lib/anmo.rb', line 12
def self.server= server
@server = server
end
|
.server_version ⇒ Object
16
17
18
|
# File 'lib/anmo.rb', line 16
def self.server_version
HTTParty.get(anmo_url("__VERSION__")).body
end
|
.stored_objects ⇒ Object
42
43
44
45
|
# File 'lib/anmo.rb', line 42
def self.stored_objects
json = HTTParty.get(anmo_url("__OBJECTS__"))
JSON.parse(json.body)
end
|