sipwizard 0.0.1 → 0.1.0

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.
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,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/cdr/count
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ apikey:
13
+ - bar
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ content-length:
20
+ - '114'
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 22:58:55 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":"The apikey header value was not recognised as belonging
34
+ to a valid account.","Result":0,"Success":false}'
35
+ http_version:
36
+ recorded_at: Sat, 01 Feb 2014 22:58:55 GMT
37
+ - request:
38
+ method: get
39
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/cdr/count
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ''
43
+ headers:
44
+ User-Agent:
45
+ - Faraday v0.8.9
46
+ apikey:
47
+ - <SIPSORCERY_API_KEY>
48
+ response:
49
+ status:
50
+ code: 200
51
+ message:
52
+ headers:
53
+ content-length:
54
+ - '42'
55
+ content-type:
56
+ - application/json; charset=utf-8
57
+ server:
58
+ - Microsoft-IIS/7.0
59
+ x-powered-by:
60
+ - ASP.NET
61
+ date:
62
+ - Sun, 09 Feb 2014 06:12:18 GMT
63
+ connection:
64
+ - close
65
+ body:
66
+ encoding: US-ASCII
67
+ string: ! '{"Error":null,"Result":1234,"Success":true}'
68
+ http_version:
69
+ recorded_at: Sun, 09 Feb 2014 06:12:20 GMT
70
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/cdr/get?where=ID%3D%22<CDR_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
+ - '1037'
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 06:16:09 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"AccountCode":null,"AnsweredReason":"Ok","AnsweredStatus":200,"AnsweredTime":"2014-02-08T17:56:34.6939005+00:00","Balance":0,"BridgeId":"bridge_id","CallDirection":"Out","CallId":"call_id","Cost":0,"Created":"2014-02-08T17:56:24.3343929+00:00","DialPlanContextID":"context_id","Dst":"dst","DstHost":"dst_host","DstURI":"dst_uri","Duration":250,"FromHeader":"<header>","FromName":null,"FromUser":"from_user","HungupReason":"remote
34
+ end hungup","HungupTime":"2014-02-08T18:00:45.1364736+00:00","ID":"<CDR_ID>","InProgressReason":"Session
35
+ progress","InProgressStatus":183,"InProgressTime":"2014-02-08T17:56:24.8343993+00:00","IncrementSeconds":0,"Inserted":"2014-02-08T17:56:24.3343929+00:00","LocalSocket":"udp:local_socket_id:port","Rate":0,"RemoteSocket":"udp:ip:port","RingDuration":10,"SetupCost":0}],"Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 09 Feb 2014 06:16:12 GMT
38
+ 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/customeraccount/add
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"AccountName":"foo","Credit":4.0}'
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 01:13:59 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<CUSTOMER_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 23 Feb 2014 01:13:59 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://www.sipsorcery.com/rest/v0.1/accounting.svc/customeraccount/add
41
+ body:
42
+ encoding: UTF-8
43
+ string: ! '{"AccountName":"foo","Credit":3.0}'
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
+ - '77'
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 01:14:08 GMT
66
+ connection:
67
+ - close
68
+ body:
69
+ encoding: US-ASCII
70
+ string: ! '{"Error":"The account name is already in use.","Result":null,"Success":false}'
71
+ http_version:
72
+ recorded_at: Sun, 23 Feb 2014 01:14:08 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/customeraccount/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 01:04:03 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 01:04:03 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/customeraccount/delete?id=<CUSTOMER_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 01:31:06 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 01:31: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/accounting.svc/customeraccount/get?where=ID%3D%22<CUSTOMER_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
+ - '239'
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 01:21:50 GMT
29
+ connection:
30
+ - close
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"Error":null,"Result":[{"AccountCode":"foobar","AccountName":"foo","AccountNumber":null,"Credit":4.00000,"ID":"<CUSTOMER_ID>","Inserted":"2014-02-23T01:13:59.8470018+00:00","PIN":null}],"Success":true}'
34
+ http_version:
35
+ recorded_at: Sun, 23 Feb 2014 01:21:50 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/customeraccount/update
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"AccountCode":"foobar","AccountName":"foo","Credit":4.0,"Inserted":"2014-02-23T01:13:59.8470018+00:00","ID":"<CUSTOMER_ID>","PIN":"1234"}'
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 01:27:10 GMT
31
+ connection:
32
+ - close
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"Error":null,"Result":"<CUSTOMER_ID>","Success":true}'
36
+ http_version:
37
+ recorded_at: Sun, 23 Feb 2014 01:27:10 GMT
38
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,75 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/add
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"DialPlanName":"foo","DialPlanScript":"sys.Dial(\"music@iptel.org\");
9
+ sys.Respond(404, \"No one home\")"}'
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 22:26:57 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 22:27:01 GMT
39
+ - request:
40
+ method: post
41
+ uri: https://www.sipsorcery.com/rest/v0.1/provisioning.svc/dialplan/add
42
+ body:
43
+ encoding: UTF-8
44
+ string: ! '{"DialPlanName":"foo","DialPlanScript":"bra"}'
45
+ headers:
46
+ User-Agent:
47
+ - Faraday v0.8.9
48
+ apikey:
49
+ - <SIPSORCERY_API_KEY>
50
+ Content-Type:
51
+ - application/json; charset=utf-8
52
+ response:
53
+ status:
54
+ code: 200
55
+ message:
56
+ headers:
57
+ content-length:
58
+ - '124'
59
+ content-type:
60
+ - application/json; charset=utf-8
61
+ server:
62
+ - Microsoft-IIS/7.0
63
+ x-powered-by:
64
+ - ASP.NET
65
+ date:
66
+ - Sat, 22 Feb 2014 22:26:58 GMT
67
+ connection:
68
+ - close
69
+ body:
70
+ encoding: US-ASCII
71
+ string: ! '{"Error":"An error occurred while updating the entries. See the inner
72
+ exception for details.","Result":null,"Success":false}'
73
+ http_version:
74
+ recorded_at: Sat, 22 Feb 2014 22:27:03 GMT
75
+ 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/copy?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:29:05 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:29:09 GMT
36
+ recorded_with: VCR 2.6.0