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/sipaccount/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
+ - Sat, 01 Feb 2014 23:01:40 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: Sat, 01 Feb 2014 23:01:41 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccount/delete?id=<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, 09 Feb 2014 00:51:04 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, 09 Feb 2014 00:51:05 GMT
36
+ - request:
37
+ method: get
38
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccount/delete?id=b44d40f8-c89e-445d-98c7-b826e5aa4bc9
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ headers:
43
+ User-Agent:
44
+ - Faraday v0.8.9
45
+ apikey:
46
+ - <SIPSORCERY_API_KEY>
47
+ response:
48
+ status:
49
+ code: 200
50
+ message:
51
+ headers:
52
+ content-length:
53
+ - '88'
54
+ content-type:
55
+ - application/json; charset=utf-8
56
+ server:
57
+ - Microsoft-IIS/7.0
58
+ x-powered-by:
59
+ - ASP.NET
60
+ date:
61
+ - Sun, 09 Feb 2014 00:52:28 GMT
62
+ connection:
63
+ - close
64
+ body:
65
+ encoding: US-ASCII
66
+ string: ! '{"Error":"The SIP account to delete could not be found.","Result":false,"Success":false}'
67
+ http_version:
68
+ recorded_at: Sun, 09 Feb 2014 00:52:30 GMT
69
+ 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/sipaccount/get?where=ID%3D%22<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
+ - '453'
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, 08 Feb 2014 23:36:13 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"AccountCode":null,"AvatarURL":null,"Description":null,"DontMangleEnabled":false,"ID":"<ID>","IPAddressACL":null,"InDialPlanName":"fooplan","IsIncomingOnly":false,"IsSwitchboardEnabled":false,"IsUserDisabled":false,"NetworkID":null,"OutDialPlanName":"barplan","SIPDomain":"foodomain","SIPPassword":"password","SIPUsername":"username","SendNATKeepAlives":false}],"Success":true}'
34
+ http_version:
35
+ recorded_at: Sat, 08 Feb 2014 23:36:14 GMT
36
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccount/update
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"DontMangleEnabled":false,"InDialPlanName":"fooplan","IsIncomingOnly":false,"IsSwitchBoardEnabled":false,"IsUserDisabled":false,"OutDialPlanName":"barplan","ID":"<ID>","SIPDomain":"foodomain","SIPUsername":"username","SIPPassword":"password","AvatarURL":"foo","SendNATKeepAlives":false}'
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, 09 Feb 2014 00:22:47 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 09 Feb 2014 00:22:49 GMT
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipaccountbinding/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, 09 Feb 2014 05:45:14 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, 09 Feb 2014 05:45:17 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/sipaccountbinding/get?where=ID%3D%22<ACCOUNT_BINDING_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
+ - '564'
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, 09 Feb 2014 05:58:07 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"ContactURI":"sip:id@ip:port","Expiry":123,"ExpiryTime":"2014-02-09T06:00:03.0480705+00:00","ID":"<ACCOUNT_BINDING_ID>","LastUpdate":"2014-02-09T05:58:03.0480705+00:00","MangledContactURI":"sip:id@ip:port","ProxySIPSocket":"udp:ip:port","RegistrarSIPSocket":"udp:ip:port","RemoteSIPSocket":"udp:ip:port","SIPAccountID":"sipaccount_id","SIPAccountName":"account_name","UserAgent":"user_agent"}],"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 09 Feb 2014 05:58:09 GMT
36
+ 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/sipprovider/add
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"ProviderName":"foo","ProviderUsername":"bar","ProviderPassword":"provider_password","ProviderServer":"provider_server","ProviderType":"provider_type","RegisterContact":"register_contact"}'
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
+ - Sat, 22 Feb 2014 22:11:54 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<PROVIDER_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sat, 22 Feb 2014 22:11:57 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/sipprovider/add
41
+ body:
42
+ encoding: UTF-8
43
+ string: ! '{"ProviderName":"foo","ProviderUsername":"bar","ProviderPassword":"bra","ProviderServer":"provider_server","ProviderType":"provider_type","RegisterContact":"register_contact"}'
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
+ - '124'
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
+ - Sat, 22 Feb 2014 22:11:55 GMT
66
+ connection:
67
+ - close
68
+ body:
69
+ encoding: US-ASCII
70
+ string: ! '{"Error":"An error occurred while updating the entries. See the inner
71
+ exception for details.","Result":null,"Success":false}'
72
+ http_version:
73
+ recorded_at: Sat, 22 Feb 2014 22:11:59 GMT
74
+ 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/sipprovider/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
+ - '42'
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, 16 Feb 2014 00:15:27 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":123,"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 16 Feb 2014 00:15:27 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/sipprovider/delete?id=<PROVIDER_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:23:02 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:23:06 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/sipprovider/get?where=ID%3D%22<PROVIDER_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
+ - '529'
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:14:02 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"CustomHeaders":null,"GVCallbackNumber":null,"GVCallbackPattern":null,"GVCallbackType":null,"ID":"<PROVIDER_ID>","ProviderAuthUsername":null,"ProviderFrom":null,"ProviderName":"foo","ProviderOutboundProxy":null,"ProviderPassword":"provider_password","ProviderServer":"provider_server","ProviderType":"provider_type","ProviderUsername":"bar","RegisterContact":"register_contact","RegisterEnabled":false,"RegisterExpiry":0,"RegisterRealm":null,"RegisterServer":null}],"Success":true}'
34
+ http_version:
35
+ recorded_at: Sat, 22 Feb 2014 22:14:06 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/provisioning.svc/sipprovider/update
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"ProviderName":"barbar","ProviderPassword":"provider_password","ProviderServer":"provider_server","ProviderType":"provider_type","ProviderUsername":"bar","RegisterContact":"register_contact","RegisterEnabled":false,"RegisterExpiry":0,"ID":"<PROVIDER_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
+ - Sat, 22 Feb 2014 22:15:11 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<PROVIDER_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sat, 22 Feb 2014 22:15:14 GMT
38
+ recorded_with: VCR 2.6.0