sipwizard 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +9 -3
  3. data/Guardfile +6 -5
  4. data/lib/sipwizard.rb +3 -0
  5. data/lib/sipwizard/account.rb +101 -0
  6. data/lib/sipwizard/binding.rb +40 -0
  7. data/lib/sipwizard/cdr.rb +59 -0
  8. data/lib/sipwizard/connection.rb +31 -7
  9. data/lib/sipwizard/customer.rb +81 -0
  10. data/lib/sipwizard/dial_plan.rb +91 -0
  11. data/lib/sipwizard/provider.rb +99 -0
  12. data/lib/sipwizard/provider_binding.rb +53 -0
  13. data/lib/sipwizard/rate.rb +81 -0
  14. data/lib/sipwizard/relation.rb +27 -0
  15. data/lib/sipwizard/version.rb +1 -1
  16. data/sipwizard.gemspec +6 -4
  17. data/spec/lib/sipwizard/account_spec.rb +80 -0
  18. data/spec/lib/sipwizard/binding_spec.rb +22 -0
  19. data/spec/lib/sipwizard/cdr_spec.rb +21 -0
  20. data/spec/lib/sipwizard/configuration_spec.rb +1 -1
  21. data/spec/lib/sipwizard/connection_spec.rb +19 -25
  22. data/spec/lib/sipwizard/customer_spec.rb +80 -0
  23. data/spec/lib/sipwizard/dial_plan_spec.rb +95 -0
  24. data/spec/lib/sipwizard/provider_binding_spec.rb +22 -0
  25. data/spec/lib/sipwizard/provider_spec.rb +107 -0
  26. data/spec/lib/sipwizard/rate_spec.rb +83 -0
  27. data/spec/lib/sipwizard_spec.rb +1 -1
  28. data/spec/spec.yml.sample +7 -0
  29. data/spec/spec_helper.rb +32 -9
  30. data/spec/vcr/sipsorcery/cdr/count.yml +70 -0
  31. data/spec/vcr/sipsorcery/cdr/get.yml +38 -0
  32. data/spec/vcr/sipsorcery/customeraccount/add.yml +73 -0
  33. data/spec/vcr/sipsorcery/customeraccount/count.yml +36 -0
  34. data/spec/vcr/sipsorcery/customeraccount/delete.yml +36 -0
  35. data/spec/vcr/sipsorcery/customeraccount/get.yml +36 -0
  36. data/spec/vcr/sipsorcery/customeraccount/update.yml +38 -0
  37. data/spec/vcr/sipsorcery/dialplan/add.yml +75 -0
  38. data/spec/vcr/sipsorcery/dialplan/copy.yml +36 -0
  39. data/spec/vcr/sipsorcery/dialplan/count.yml +36 -0
  40. data/spec/vcr/sipsorcery/dialplan/delete.yml +36 -0
  41. data/spec/vcr/sipsorcery/dialplan/get.yml +37 -0
  42. data/spec/vcr/sipsorcery/dialplan/update.yml +39 -0
  43. data/spec/vcr/sipsorcery/rate/add.yml +73 -0
  44. data/spec/vcr/sipsorcery/rate/count.yml +36 -0
  45. data/spec/vcr/sipsorcery/rate/delete.yml +36 -0
  46. data/spec/vcr/sipsorcery/rate/get.yml +36 -0
  47. data/spec/vcr/sipsorcery/rate/update.yml +38 -0
  48. data/spec/vcr/sipsorcery/sipaccount/add.yml +74 -0
  49. data/spec/vcr/sipsorcery/sipaccount/count.yml +36 -0
  50. data/spec/vcr/sipsorcery/sipaccount/delete.yml +69 -0
  51. data/spec/vcr/sipsorcery/sipaccount/get.yml +36 -0
  52. data/spec/vcr/sipsorcery/sipaccount/update.yml +37 -0
  53. data/spec/vcr/sipsorcery/sipaccountbinding/count.yml +36 -0
  54. data/spec/vcr/sipsorcery/sipaccountbinding/get.yml +36 -0
  55. data/spec/vcr/sipsorcery/sipprovider/add.yml +74 -0
  56. data/spec/vcr/sipsorcery/sipprovider/count.yml +36 -0
  57. data/spec/vcr/sipsorcery/sipprovider/delete.yml +36 -0
  58. data/spec/vcr/sipsorcery/sipprovider/get.yml +36 -0
  59. data/spec/vcr/sipsorcery/sipprovider/update.yml +38 -0
  60. data/spec/vcr/sipsorcery/sipproviderbinding/count.yml +36 -0
  61. data/spec/vcr/sipsorcery/sipproviderbinding/get.yml +69 -0
  62. metadata +129 -6
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/count
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '41'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Fri, 21 Feb 2014 03:24:58 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":1234,"Success":true}'
34
+ http_version:
35
+ recorded_at: Fri, 21 Feb 2014 03:24:58 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/delete?id=<DIALPLAN_ID>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '43'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Sat, 22 Feb 2014 22:32:10 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":true,"Success":true}'
34
+ http_version:
35
+ recorded_at: Sat, 22 Feb 2014 22:32:13 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/get?where=ID%3D%22<DIALPLAN_ID>%22&count=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '271'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Sat, 22 Feb 2014 21:54:26 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"AcceptNonInvite":false,"DialPlanName":"foo","DialPlanScript":"sys.Dial(\"music@iptel.org\");
34
+ sys.Respond(404, \"No one home\")","ID":"<DIALPLAN_ID>","ScriptTypeDescription":"Ruby","TraceEmailAddress":null}],"Success":true}'
35
+ http_version:
36
+ recorded_at: Sat, 22 Feb 2014 21:54:30 GMT
37
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/update
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"AcceptNonInvite":false,"DialPlanName":"foo","DialPlanScript":"sys.Dial(\"music@iptel.org\");
9
+ sys.Respond(404, \"No one home\")","ScriptTypeDescription":"Ruby","TraceEmailAddress":"foo@bar.com","ID":"<DIALPLAN_ID>"}'
10
+ headers:
11
+ User-Agent:
12
+ - Faraday v0.8.9
13
+ apikey:
14
+ - <SIPSORCERY_API_KEY>
15
+ Content-Type:
16
+ - application/json; charset=utf-8
17
+ response:
18
+ status:
19
+ code: 200
20
+ message:
21
+ headers:
22
+ content-length:
23
+ - '77'
24
+ content-type:
25
+ - application/json; charset=utf-8
26
+ server:
27
+ - Microsoft-IIS/7.0
28
+ x-powered-by:
29
+ - ASP.NET
30
+ date:
31
+ - Sat, 22 Feb 2014 21:54:27 GMT
32
+ connection:
33
+ - close
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! '{"Error":null,"Result":"<DIALPLAN_ID>","Success":true}'
37
+ http_version:
38
+ recorded_at: Sat, 22 Feb 2014 21:54:31 GMT
39
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/add
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"Description":"foo","Prefix":"777","Rate":2.0,"SetupCost":0,"IncrementSeconds":1}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ Content-Type:
15
+ - application/json; charset=utf-8
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ content-length:
22
+ - '77'
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ server:
26
+ - Microsoft-IIS/7.0
27
+ x-powered-by:
28
+ - ASP.NET
29
+ date:
30
+ - Sun, 23 Feb 2014 21:47:53 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<RATE_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 23 Feb 2014 21:47:49 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/add
41
+ body:
42
+ encoding: UTF-8
43
+ string: ! '{"Description":"bar","Prefix":"777","Rate":1.0,"SetupCost":0,"IncrementSeconds":1}'
44
+ headers:
45
+ User-Agent:
46
+ - Faraday v0.8.9
47
+ apikey:
48
+ - <SIPSORCERY_API_KEY>
49
+ Content-Type:
50
+ - application/json; charset=utf-8
51
+ response:
52
+ status:
53
+ code: 200
54
+ message:
55
+ headers:
56
+ content-length:
57
+ - '76'
58
+ content-type:
59
+ - application/json; charset=utf-8
60
+ server:
61
+ - Microsoft-IIS/7.0
62
+ x-powered-by:
63
+ - ASP.NET
64
+ date:
65
+ - Sun, 23 Feb 2014 21:49:46 GMT
66
+ connection:
67
+ - close
68
+ body:
69
+ encoding: US-ASCII
70
+ string: ! '{"Error":"The rate prefix is already in use.","Result":null,"Success":false}'
71
+ http_version:
72
+ recorded_at: Sun, 23 Feb 2014 21:49:43 GMT
73
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/count
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '40'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Sun, 23 Feb 2014 21:19:57 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":1234,"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 23 Feb 2014 21:19:55 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/delete?id=<RATE_ID>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '43'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Sun, 23 Feb 2014 22:07:13 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":true,"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 23 Feb 2014 22:07:09 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/get?where=ID%3D%22<RATE_ID>%22&count=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '240'
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.0
25
+ x-powered-by:
26
+ - ASP.NET
27
+ date:
28
+ - Sun, 23 Feb 2014 21:52:12 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"Description":"foo","ID":"<RATE_ID>","IncrementSeconds":1,"Inserted":"2014-02-23T21:47:53.3581120+00:00","Prefix":"777","Rate":2.00000,"RateCode":null,"SetupCost":0.00000}],"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 23 Feb 2014 21:52:09 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/rate/update
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"Description":"foo","IncrementSeconds":1,"Inserted":"2014-02-23T21:47:53.3581120+00:00","Prefix":"1234","Rate":2.0,"SetupCost":0.0,"ID":"<RATE_ID>"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ Content-Type:
15
+ - application/json; charset=utf-8
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ content-length:
22
+ - '77'
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ server:
26
+ - Microsoft-IIS/7.0
27
+ x-powered-by:
28
+ - ASP.NET
29
+ date:
30
+ - Sun, 23 Feb 2014 22:01:35 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<RATE_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 23 Feb 2014 22:01:32 GMT
38
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,74 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccount/add
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"SIPUsername":"foo","SIPPassword":"bar"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - <SIPSORCERY_API_KEY>
14
+ Content-Type:
15
+ - application/json; charset=utf-8
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ content-length:
22
+ - '77'
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ server:
26
+ - Microsoft-IIS/7.0
27
+ x-powered-by:
28
+ - ASP.NET
29
+ date:
30
+ - Sun, 02 Feb 2014 05:35:59 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"aaaaaaaa-613d-43a3-8aa7-75f5b8ed66gd","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 02 Feb 2014 05:35:59 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccount/add
41
+ body:
42
+ encoding: UTF-8
43
+ string: ! '{"SIPUsername":"foo","SIPPassword":"bra"}'
44
+ headers:
45
+ User-Agent:
46
+ - Faraday v0.8.9
47
+ apikey:
48
+ - <SIPSORCERY_API_KEY>
49
+ Content-Type:
50
+ - application/json; charset=utf-8
51
+ response:
52
+ status:
53
+ code: 200
54
+ message:
55
+ headers:
56
+ content-length:
57
+ - '112'
58
+ content-type:
59
+ - application/json; charset=utf-8
60
+ server:
61
+ - Microsoft-IIS/7.0
62
+ x-powered-by:
63
+ - ASP.NET
64
+ date:
65
+ - Sun, 02 Feb 2014 05:38:34 GMT
66
+ connection:
67
+ - close
68
+ body:
69
+ encoding: US-ASCII
70
+ string: ! '{"Error":"Sorry the requested username and domain combination is
71
+ already in use.","Result":null,"Success":false}'
72
+ http_version:
73
+ recorded_at: Sun, 02 Feb 2014 05:38:34 GMT
74
+ recorded_with: VCR 2.6.0