tropo-webapi-sdk-ruby 15.10.1 → 15.11.0.pre.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d318399f0e321377af8bb4f0572664f19c884afe
4
- data.tar.gz: d5ca6fac58e74ddc15dd92d3fcf137b8707373c5
3
+ metadata.gz: bb36ff4f37691dd71545b4998020f0a08a41d7b4
4
+ data.tar.gz: 3d5aef58d8c54075f6a01e6b57a08cafa366634e
5
5
  SHA512:
6
- metadata.gz: 4189478223535ee3a44a6dbf0b87a33e70771ca96dea1a1388d93170fd727d20a77cdaa0c7ee49c72dac83275eecbfdc44643126becba2d0ae7943631d091700
7
- data.tar.gz: 20f5aabfe66c851d451ea80a3df26c535443b0eb5513b5c0b5253e78242c063a7fb6387c84987c9aba76b865c35c9cc7243c3f71ed19d02f6938db2e8fda1359
6
+ metadata.gz: f1f40f956b0f1e8cd55f54a360046dc91eb741c3d425c2e62a3c3bd57962cba0bfc7cf214a8d054b0e3f37c59028723b1691118fe42bb6fc0dedf4f5483c4545
7
+ data.tar.gz: 8627a7f28d19b9c7a1e1833eb7ffdde9732fad1fd18b8b01ca38b36ce74b421695a4916198f5bf551fbae68a71b11358489e100705ecfeeae4f52110f4235d7d
@@ -21,33 +21,33 @@ module Tropo
21
21
  end
22
22
  end
23
23
  when 'call'
24
- has_params?(params, 'call', ['to', 'name'])
24
+ has_params?(params, 'call', ['to'])
25
25
  when 'conference'
26
- has_params?(params, 'conference', ['name', 'id'])
26
+ has_params?(params, 'conference', ['id'])
27
27
  when 'on'
28
28
  has_params?(params, 'on', 'event')
29
29
  when 'record'
30
- has_params?(params, 'record', ['name', 'url'])
30
+ has_params?(params, 'record', ['url'])
31
31
  when 'start_recording'
32
32
  has_params?(params, 'start_recording', ['url'])
33
33
 
34
34
  # Camelcase this one to be Java friendly
35
35
  action = 'startRecording'
36
36
  when 'redirect'
37
- has_params?(params, 'redirect', ['to', 'name'])
37
+ has_params?(params, 'redirect', ['to'])
38
38
  raise ArgumentError, "Redirect should only be used alone and before the session is answered, use transfer instead" if @nested_hash
39
39
  when 'say'
40
- has_params?(params, 'say', ['value', 'name'])
40
+ has_params?(params, 'say', ['value'])
41
41
  return build_elements(params)
42
42
  when 'nestedSay'
43
43
  has_params?(params, 'say', 'value')
44
44
  return build_elements(params)
45
45
  when 'transfer'
46
- has_params?(params, 'transfer', ['to', 'name'])
46
+ has_params?(params, 'transfer', ['to'])
47
47
  when 'wait'
48
48
  has_params?(params, 'wait', 'milliseconds')
49
49
  when 'message'
50
- has_params?(params, 'message', ['say', 'to', 'name'])
50
+ has_params?(params, 'message', ['say', 'to'])
51
51
  end
52
52
 
53
53
  if action == 'on'
@@ -126,12 +126,36 @@ module Tropo
126
126
  # @return [Hash] returns the elements properly formatted in a hash
127
127
  def build_elements(params)
128
128
  if params[:url]
129
- uri = URI.parse params[:url]
130
- # Check to see if it is a valid http address
131
- if uri.class != URI::HTTP
132
- # Check to see if it is a valid email address
133
- if params[:url].match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/) == false
134
- raise ArgumentError, "The 'url' paramater must be a valid URL"
129
+ if params[:url].is_a? Array
130
+ for i in params[:url] do
131
+ uri = URI.parse i[:url]
132
+ # Check to see if it is a valid http address
133
+ if uri.class != URI::HTTP
134
+ # Check to see if it is a valid email address
135
+ if params[:url].match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/) == false
136
+ raise ArgumentError, "The 'url' paramater must be a valid URL"
137
+ end
138
+ end
139
+ end
140
+ elsif params[:url].nil?
141
+ if params[:url][:url].nil?
142
+ uri = URI.parse params[:url][:url]
143
+ # Check to see if it is a valid http address
144
+ if uri.class != URI::HTTP
145
+ # Check to see if it is a valid email address
146
+ if params[:url].match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/) == false
147
+ raise ArgumentError, "The 'url' paramater must be a valid URL"
148
+ end
149
+ end
150
+ else
151
+ uri = URI.parse params[:url]
152
+ # Check to see if it is a valid http address
153
+ if uri.class != URI::HTTP
154
+ # Check to see if it is a valid email address
155
+ if params[:url].match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/) == false
156
+ raise ArgumentError, "The 'url' paramater must be a valid URL"
157
+ end
158
+ end
135
159
  end
136
160
  end
137
161
  end
@@ -565,8 +565,10 @@ module Tropo
565
565
  # if the method has been called from inside a block
566
566
  def record(params={}, &block)
567
567
  if block_given?
568
- create_nested_hash('record', params)
568
+ @nested_hash = {:record => build_elements(params)}
569
+ @nested_name = 'record'
569
570
  instance_exec(&block)
571
+ has_params?(@nested_hash[:record], 'record', ['url'])
570
572
  @response[:tropo] << @nested_hash
571
573
  @nested_hash = nil
572
574
  @nested_name = nil
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tropo-webapi-sdk-ruby}
8
- s.version = "15.10.1"
8
+ s.version = "15.11.0-alpha"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Goecke"]
12
- s.date = %q{2017-12-06}
12
+ s.date = %q{2018-05-11}
13
13
  s.description = %q{Ruby library for interacting with the Tropo Web API via REST & JSON}
14
14
  s.email = %q{xiangjyu@cisco.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tropo-webapi-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.10.1
4
+ version: 15.11.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Goecke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec