verboice 0.5.1 → 0.6.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 +21 -8
  2. metadata +17 -7
data/lib/verboice.rb CHANGED
@@ -31,20 +31,33 @@ class Verboice
31
31
  end
32
32
 
33
33
  def call address, options = {}
34
- args = {:channel => options[:channel] || @default_channel, :address => address}
34
+ options = options.dup
35
35
 
36
- args[:not_before] = options[:not_before].iso8601 if options[:not_before]
37
- args[:queue] = options[:queue] if options[:queue]
38
- args[:project_id] = options[:project_id] if options[:project_id]
36
+ args = {}
37
+ if channel = options.delete(:channel)
38
+ args[:channel] = channel
39
+ else
40
+ args[:channel] = @default_channel
41
+ end
42
+
43
+ args[:address] = address
44
+
45
+ if not_before = options.delete(:not_before)
46
+ args[:not_before] = not_before.iso8601
47
+ end
48
+
49
+ flow = options.delete(:flow)
50
+ callback_url = options.delete(:callback_url)
51
+
52
+ args.merge!(options)
39
53
 
40
- if options[:flow]
41
- post "/api/call?#{self.class.to_query args}", options[:flow] do |response, error|
54
+ if flow
55
+ post "/api/call?#{self.class.to_query args}", flow do |response, error|
42
56
  raise Verboice::Exception.new error.message if error
43
57
  JSON.parse response.body
44
58
  end
45
59
  else
46
- args[:callback_url] = options[:callback_url] if options[:callback_url]
47
- args[:call_flow_id] = options[:call_flow_id] if options[:call_flow_id]
60
+ args[:callback_url] = callback_url if callback_url
48
61
  get_json "/api/call?#{self.class.to_query args}"
49
62
  end
50
63
  end
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.5.1
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
12
+ 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: &70192743416520 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70192743416520
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: json
27
- requirement: &70192743415540 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70192743415540
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: Access the Verboice API in ruby.
37
47
  email: aromero@manas.com.ar
38
48
  executables: []
@@ -61,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
71
  version: '0'
62
72
  requirements: []
63
73
  rubyforge_project:
64
- rubygems_version: 1.8.11
74
+ rubygems_version: 1.8.23
65
75
  signing_key:
66
76
  specification_version: 3
67
77
  summary: Access the Verboice API in ruby