onsip 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onsip/models/account.rb +1 -0
- data/lib/onsip/models/cdr.rb +1 -0
- data/lib/onsip/models/external_address.rb +2 -1
- data/lib/onsip/models/organization.rb +38 -0
- data/lib/onsip/models/user.rb +18 -0
- data/lib/onsip/models/user_address.rb +3 -1
- data/lib/onsip/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e29ab33f57655de34d9b69599eebfca128a1ce57
|
4
|
+
data.tar.gz: 2c0845e5478cca4fa435b97c2f1f460b57bead27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85e36ade172234483255dcc70aeab5a49fd1b8e7bb3628c3f4b88ca31f9561162bd619040664093977c176a1a1e029aa9f768912a0b633e973a88452f7647744
|
7
|
+
data.tar.gz: c6c000e1e22c61b5aa8c5d44747075e9e7056d4f9f384b023f6d3dda1e2e0e063f3de2b5e0c76342d039dc24372cfa5291c39a49ad21ac0210fc4373d0c579b2
|
data/lib/onsip/models/account.rb
CHANGED
@@ -29,6 +29,7 @@ module OnSIP
|
|
29
29
|
module ClassMethods
|
30
30
|
def read(account_id)
|
31
31
|
response = OnSIP.connection.get('/api', {'Action' => 'AccountRead', 'AccountId' => account_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}, {})
|
32
|
+
yield response if block_given?
|
32
33
|
process_read_account_response response
|
33
34
|
end
|
34
35
|
|
data/lib/onsip/models/cdr.rb
CHANGED
@@ -10,6 +10,7 @@ module OnSIP
|
|
10
10
|
def browse(args = {})
|
11
11
|
params = args.merge({'Action' => 'CdrBrowse', 'SessionId' => OnSIP.session.id, 'Output' => 'json'})
|
12
12
|
response = OnSIP.connection.get('/api', params, {})
|
13
|
+
yield response if block_given?
|
13
14
|
process_browse_cdrs_response response
|
14
15
|
end
|
15
16
|
|
@@ -16,6 +16,7 @@ module OnSIP
|
|
16
16
|
def browse(args)
|
17
17
|
params = args.merge({'Action' => 'ExternalAddressBrowse', 'SessionId' => OnSIP.session.id, 'Output' => 'json'})
|
18
18
|
response = OnSIP.connection.get('/api', params, {})
|
19
|
+
yield response if block_given?
|
19
20
|
process_browse_external_address_response response
|
20
21
|
end
|
21
22
|
|
@@ -30,7 +31,7 @@ module OnSIP
|
|
30
31
|
end
|
31
32
|
|
32
33
|
# TODO
|
33
|
-
def delete(*args)
|
34
|
+
def delete!(*args)
|
34
35
|
raise NotImplementedError
|
35
36
|
end
|
36
37
|
|
@@ -6,6 +6,21 @@ module OnSIP
|
|
6
6
|
@attributes.OrganizationId
|
7
7
|
end
|
8
8
|
|
9
|
+
# Adds a User to the Organization
|
10
|
+
#
|
11
|
+
# reference at http://developer.onsip.com/admin-api/Users/#user-add
|
12
|
+
#
|
13
|
+
# @example Add User
|
14
|
+
# attrs = {'Username' => 'docs',
|
15
|
+
# 'Domain' => 'example.onsip.com',
|
16
|
+
# 'Name' => 'Docs',
|
17
|
+
# 'Email' => 'docs@example.onsip.com',
|
18
|
+
# 'AuthUsername' => 'example',
|
19
|
+
# 'Password' => 'mysuperpassword',
|
20
|
+
# 'PasswordConfirm' => 'mysuperpassword'}
|
21
|
+
# organziation.add_user(attrs)
|
22
|
+
#
|
23
|
+
# @return [ User ] The created User.
|
9
24
|
def add_user(attrs = {})
|
10
25
|
User.add self, attrs
|
11
26
|
end
|
@@ -14,6 +29,7 @@ module OnSIP
|
|
14
29
|
def browse(account_id)
|
15
30
|
params = {'Action' => 'OrganizationBrowse', 'AccountId' => account_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}
|
16
31
|
response = OnSIP.connection.get('/api', params, {})
|
32
|
+
yield response if block_given?
|
17
33
|
process_browse_organization_response response
|
18
34
|
end
|
19
35
|
|
@@ -30,6 +46,7 @@ module OnSIP
|
|
30
46
|
def read(organization_id)
|
31
47
|
params = {'Action' => 'OrganizationRead', 'OrganizationId' => organization_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}
|
32
48
|
response = OnSIP.connection.get('/api', params, {})
|
49
|
+
yield response if block_given?
|
33
50
|
process_read_organization_response response
|
34
51
|
end
|
35
52
|
|
@@ -38,10 +55,31 @@ module OnSIP
|
|
38
55
|
|
39
56
|
key_path = %w(Response Result OrganizationRead Organization)
|
40
57
|
a = ResponseParser.parse_response response, key_path
|
58
|
+
yield response if block_given?
|
41
59
|
organization = (a.map { |h| new h }).first if a
|
42
60
|
|
43
61
|
organization
|
44
62
|
end
|
63
|
+
|
64
|
+
// TODO
|
65
|
+
def add(*args)
|
66
|
+
raise NotImplementedError
|
67
|
+
end
|
68
|
+
|
69
|
+
// TODO
|
70
|
+
def edit_contact(*args)
|
71
|
+
raise NotImplementedError
|
72
|
+
end
|
73
|
+
|
74
|
+
// TODO
|
75
|
+
def migrate_domain(*args)
|
76
|
+
raise NotImplementedError
|
77
|
+
end
|
78
|
+
|
79
|
+
// TODO
|
80
|
+
def edit_authenticated(*args)
|
81
|
+
raise NotImplementedError
|
82
|
+
end
|
45
83
|
end
|
46
84
|
|
47
85
|
extend ClassMethods
|
data/lib/onsip/models/user.rb
CHANGED
@@ -54,6 +54,7 @@ module OnSIP
|
|
54
54
|
def delete!(user_id)
|
55
55
|
params = {'Action' => 'UserDelete', 'SessionId' => OnSIP.session.id, 'UserId' => user_id, 'Output' => 'json'}
|
56
56
|
response = OnSIP.connection.get('/api', params, {})
|
57
|
+
yield response if block_given?
|
57
58
|
process_delete_user_response response
|
58
59
|
end
|
59
60
|
|
@@ -70,6 +71,7 @@ module OnSIP
|
|
70
71
|
def edit_status(user_id, attrs = {})
|
71
72
|
params = attrs.merge({'Action' => 'UserEditStatus', 'SessionId' => OnSIP.session.id, 'UserId' => user_id, 'Output' => 'json'})
|
72
73
|
response = OnSIP.connection.get('/api', params, {})
|
74
|
+
yield response if block_given?
|
73
75
|
process_edit_user_status_response response
|
74
76
|
end
|
75
77
|
|
@@ -84,6 +86,20 @@ module OnSIP
|
|
84
86
|
user
|
85
87
|
end
|
86
88
|
|
89
|
+
# Adds a User to an Organization
|
90
|
+
#
|
91
|
+
# reference at http://developer.onsip.com/admin-api/Users/#user-add
|
92
|
+
#
|
93
|
+
# @example Add User
|
94
|
+
# attrs = {'Username' => 'docs',
|
95
|
+
# 'Name' => 'Docs',
|
96
|
+
# 'Email' => 'docs@example.onsip.com',
|
97
|
+
# 'AuthUsername' => 'example',
|
98
|
+
# 'Password' => 'mysuperpassword',
|
99
|
+
# 'PasswordConfirm' => 'mysuperpassword'}
|
100
|
+
# User.add(organization, attrs)
|
101
|
+
#
|
102
|
+
# @return [ User ] The created User.
|
87
103
|
def add(organization, attrs = {})
|
88
104
|
params = attrs.merge({'Action' => 'UserAdd',
|
89
105
|
'SessionId' => OnSIP.session.id,
|
@@ -91,6 +107,7 @@ module OnSIP
|
|
91
107
|
'Domain' => organization.attributes.Domain,
|
92
108
|
'Output' => 'json'})
|
93
109
|
response = OnSIP.connection.get('/api', params, {})
|
110
|
+
yield response if block_given?
|
94
111
|
process_add_user_response response
|
95
112
|
end
|
96
113
|
|
@@ -106,6 +123,7 @@ module OnSIP
|
|
106
123
|
|
107
124
|
def read(user_id)
|
108
125
|
response = OnSIP.connection.get('/api', {'Action' => 'UserRead', 'UserId' => user_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}, {})
|
126
|
+
yield response if block_given?
|
109
127
|
process_read_user_response response
|
110
128
|
end
|
111
129
|
|
@@ -12,6 +12,7 @@ module OnSIP
|
|
12
12
|
def browse(args)
|
13
13
|
params = args.merge({'Action' => 'UserAddressBrowse', 'SessionId' => OnSIP.session.id, 'Output' => 'json'})
|
14
14
|
response = OnSIP.connection.get('/api', params, {})
|
15
|
+
yield response if block_given?
|
15
16
|
process_browse_user_address_response response
|
16
17
|
end
|
17
18
|
|
@@ -37,6 +38,7 @@ module OnSIP
|
|
37
38
|
'Output' => 'json' })
|
38
39
|
|
39
40
|
response = OnSIP.connection.get('/api', params, {})
|
41
|
+
yield response if block_given?
|
40
42
|
process_add_user_address_response response
|
41
43
|
end
|
42
44
|
|
@@ -61,7 +63,7 @@ module OnSIP
|
|
61
63
|
end
|
62
64
|
|
63
65
|
# TODO
|
64
|
-
def delete(*args)
|
66
|
+
def delete!(*args)
|
65
67
|
raise NotImplementedError
|
66
68
|
end
|
67
69
|
|
data/lib/onsip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onsip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Larrimore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -310,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
310
|
version: '0'
|
311
311
|
requirements: []
|
312
312
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.2.
|
313
|
+
rubygems_version: 2.2.0
|
314
314
|
signing_key:
|
315
315
|
specification_version: 4
|
316
316
|
summary: OnSIP ruby client.
|