alucma 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7b44cfa406231af424b0cb6512ff09a95b7d787
4
- data.tar.gz: 6474c3354a9de8602ad4ff16f980b4ee41c39674
3
+ metadata.gz: 1fec90d123890ff5b6d2b2ae51c2ec5f7edba828
4
+ data.tar.gz: 96ecaf1d17de694cf22d3d602860c4a4280cd49c
5
5
  SHA512:
6
- metadata.gz: 145fcc99c3b3953410061cf412682ff9ddb6f40788afd6f74cb30d565d088a9b56473bf7e6c5aaffded9a7bf268a08b9b753a9ff84a8dbc5844c2c20d210df34
7
- data.tar.gz: ab160844e6992c16780691c4ffdfbe039232215d89aa418d4b15df89d758e3841ed60082fc37dfe6917b1ace9c38d87bde36511dd418c2ddb1b4a2a47e3d70b3
6
+ metadata.gz: d5804680356d1f736ffb6cfca80217b920d5b6e7ed75390b2fb5d131180b9a43cb2935dbfe1236236b6aba337038dfa6e22023847a4ce5ea867041d9bd466775
7
+ data.tar.gz: abfbd7d3e33d1ea2de4a7b4cc5b9d0128e10518f7374bcc9eb646c6b08d17e61b6f6fe619091ad486ae17f8a8a17230f3d7f1103818197b95ea87ad510312c13
@@ -9,13 +9,21 @@ class Client
9
9
  }
10
10
  end
11
11
 
12
- def make_call(phonenumber,displayname)
13
- return Http.post("http://api.foundry.att.net:9001/a1/nca/callcontrol/call/#{phonenumber}", self.headers, {
14
- "p1_displayName" => "#{displayname}",
15
- "announcement" => "http://www.freshsupercool.com/wp-content/uploads/2015/11/Silent.wav"
12
+ def subscribe_to_number(phonenumber,direction,criteria,callback_url)
13
+ return Http.post("http://api.foundry.att.net:9001/a1/nca/subscription/callEvent/#{phonenumber}", self.headers, {
14
+ "addressDirection" => direction,
15
+ "criteria" => criteria,
16
+ "url" => callback_url
16
17
  }.to_json)
17
18
  end
18
19
 
20
+ def make_call(phonenumber,displayname,recording_url=nil)
21
+ params = {}
22
+ params["p1_displayName"] = displayname
23
+ params["announcement"] = recording_url if recording_url
24
+ return Http.post("http://api.foundry.att.net:9001/a1/nca/callcontrol/call/#{phonenumber}", self.headers, params.to_json)
25
+ end
26
+
19
27
  def subscribe_to_call(session_id,callback_url)
20
28
  return Http.post("http://api.foundry.att.net:9001/a1/nca/interaction/subscribe", self.headers, {
21
29
  "sessionId": session_id,
@@ -1,5 +1,5 @@
1
1
  class Http
2
- def self.post(url, headers, payload)
2
+ def self.post(url, headers, payload=nil)
3
3
  begin
4
4
  uri = URI.parse(url)
5
5
  http = Net::HTTP.new(uri.host,uri.port)
@@ -15,7 +15,12 @@ class Http
15
15
  end
16
16
 
17
17
  res = http.request(req)
18
- return res.body
18
+
19
+ if res.body
20
+ return JSON.parse res.body
21
+ else
22
+ return { :error => true, :response => res.body }
23
+ end
19
24
  rescue => e
20
25
  puts e.to_s
21
26
  return false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alucma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pulak Khurana (Nick)