anmo 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/anmo.rb +14 -7
  2. data/lib/anmo/version.rb +1 -1
  3. metadata +1 -1
data/lib/anmo.rb CHANGED
@@ -14,7 +14,7 @@ module Anmo
14
14
  end
15
15
 
16
16
  def self.server_version
17
- HTTParty.get("#{server}/__VERSION__").body
17
+ HTTParty.get(anmo_url("__VERSION__")).body
18
18
  end
19
19
 
20
20
  def self.launch_server port = 8787
@@ -23,28 +23,35 @@ module Anmo
23
23
  end
24
24
 
25
25
  def self.create_request options
26
- HTTParty.post("#{server}/__CREATE_OBJECT__", {:body => options.to_json, :headers => {"Content-Type" => "application/json"}})
26
+ HTTParty.post(anmo_url("__CREATE_OBJECT__"), {:body => options.to_json, :headers => {"Content-Type" => "application/json"}})
27
27
  end
28
28
 
29
29
  def self.delete_all
30
- HTTParty.post("#{server}/__DELETE_ALL_OBJECTS__")
30
+ HTTParty.post(anmo_url("__DELETE_ALL_OBJECTS__"))
31
31
  end
32
32
 
33
33
  def self.requests
34
- json = HTTParty.get("#{server}/__REQUESTS__")
34
+ json = HTTParty.get(anmo_url("__REQUESTS__"))
35
35
  JSON.parse(json.body)
36
36
  end
37
37
 
38
38
  def self.delete_all_requests
39
- HTTParty.post("#{server}/__DELETE_ALL_REQUESTS__")
39
+ HTTParty.post(anmo_url("__DELETE_ALL_REQUESTS__"))
40
40
  end
41
41
 
42
42
  def self.stored_objects
43
- json = HTTParty.get("#{server}/__OBJECTS__")
43
+ json = HTTParty.get(anmo_url("__OBJECTS__"))
44
44
  JSON.parse(json.body)
45
45
  end
46
46
 
47
47
  def self.running?
48
- HTTParty.get("#{server}/__ALIVE__").code == 200 rescue false
48
+ HTTParty.get(anmo_url("__ALIVE__")).code == 200 rescue false
49
+ end
50
+
51
+ private
52
+
53
+ def self.anmo_url path
54
+ "#{server}/#{path}"
55
+ # URI.join(server, path).to_s
49
56
  end
50
57
  end
data/lib/anmo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Anmo
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: