opensips-pi-rest 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,37 +1,43 @@
1
- class SubscribersApp < Sinatra::Base
2
-
3
- post "/" do
4
- required_params :username, :password do
5
- Opensips::Pi.add(params[:username], params[:password], params[:domain]).tap do |response|
6
- halt 400, response.last unless response.first
7
- end
8
- end
1
+ module Opensips
2
+ module Pi
3
+ module Rest
4
+ class SubscribersApp < Sinatra::Base
5
+
6
+ post "/" do
7
+ required_params :username, :password do
8
+ Opensips::Pi.add(params[:username], params[:password], params[:domain]).tap do |response|
9
+ halt 400, response.last unless response.first
10
+ end
11
+ end
9
12
 
10
- 200
11
- end
13
+ 200
14
+ end
12
15
 
13
- delete "/:id" do
14
- Opensips::Pi.remove(params[:id],params[:domain]).tap do |response|
15
- halt 400, response.last unless response.first
16
- end
16
+ delete "/:id" do
17
+ Opensips::Pi.remove(params[:id],params[:domain]).tap do |response|
18
+ halt 400, response.last unless response.first
19
+ end
17
20
 
18
- 200
19
- end
21
+ 200
22
+ end
20
23
 
21
- put "/:id/password" do
22
- Opensips::Pi.password(params[:id],params[:password],params[:domain]).tap do |response|
23
- halt 400, response.last unless response.first
24
- end
24
+ put "/:id/password" do
25
+ Opensips::Pi.password(params[:id],params[:password],params[:domain]).tap do |response|
26
+ halt 400, response.last unless response.first
27
+ end
25
28
 
26
- 200
27
- end
29
+ 200
30
+ end
28
31
 
29
- private
30
- def required_params *keys
31
- keys.each do |k|
32
- halt 400 unless params[k].present?
33
- end
32
+ private
33
+ def required_params *keys
34
+ keys.each do |k|
35
+ halt 400 unless params[k].present?
36
+ end
34
37
 
35
- yield
38
+ yield
39
+ end
40
+ end
41
+ end
36
42
  end
37
43
  end
@@ -1,7 +1,7 @@
1
1
  module Opensips
2
2
  module Pi
3
3
  module Rest
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensips-pi-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: