verboice 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/verboice.rb +12 -9
  2. metadata +5 -5
data/lib/verboice.rb CHANGED
@@ -31,9 +31,8 @@ class Verboice
31
31
  end
32
32
 
33
33
  def call address, options = {}
34
- args = {:address => address}
35
-
36
- args[:channel] = options[:channel] || @default_channel
34
+ args = {:channel => options[:channel] || @default_channel, :address => address}
35
+
37
36
  args[:not_before] = options[:not_before].iso8601 if options[:not_before]
38
37
  args[:queue] = options[:queue] if options[:queue]
39
38
 
@@ -71,29 +70,33 @@ class Verboice
71
70
  response
72
71
  end
73
72
  end
74
-
73
+
74
+ def list_channels()
75
+ get_json "/api/channels.json"
76
+ end
77
+
75
78
  def call_queues
76
79
  get_json "/api/call_queues.json"
77
80
  end
78
-
81
+
79
82
  def call_queue(name)
80
83
  get_json "/api/call_queues/#{name}.json"
81
84
  end
82
-
85
+
83
86
  def create_call_queue(call_queue)
84
87
  post "/api/call_queues", call_queue.to_json do |response, error|
85
88
  raise Verboice::Exception.new error.message if error
86
89
  response
87
90
  end
88
91
  end
89
-
92
+
90
93
  def update_call_queue(name, call_queue)
91
94
  put "/api/call_queues/#{name}", call_queue.to_json do |response, error|
92
95
  raise Verboice::Exception.new error.message if error
93
96
  response
94
97
  end
95
98
  end
96
-
99
+
97
100
  def delete_call_queue(name)
98
101
  delete "/api/call_queues/#{name}" do |response, error|
99
102
  raise Verboice::Exception.new error.message if error
@@ -128,7 +131,7 @@ class Verboice
128
131
  rescue => ex
129
132
  yield nil, ex
130
133
  end
131
-
134
+
132
135
  def put(path, data)
133
136
  resource = RestClient::Resource.new @url, @options
134
137
  resource = resource[path].put(data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verboice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &70194475148860 !ruby/object:Gem::Requirement
16
+ requirement: &70150116524760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70194475148860
24
+ version_requirements: *70150116524760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70194475147460 !ruby/object:Gem::Requirement
27
+ requirement: &70150116524260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70194475147460
35
+ version_requirements: *70150116524260
36
36
  description: Access the Verboice API in ruby.
37
37
  email: aromero@manas.com.ar
38
38
  executables: []