onsip 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/onsip/models/account.rb +13 -6
- data/lib/onsip/models/external_address.rb +46 -0
- data/lib/onsip/models/user.rb +1 -1
- data/lib/onsip/models/{address.rb → user_address.rb} +8 -8
- data/lib/onsip/version.rb +1 -1
- data/lib/onsip.rb +2 -1
- data/onsip.gemspec +2 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad17648a70e882c6942e45f56a9dfb75122616ef
|
4
|
+
data.tar.gz: 5b3825ba82b1153a67792fd068d4f313a0f88608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c4b98ec04dbd95008730ac66f5413a708c49e509bbd6d2f8ed6d05059f6a67eb80c1e5bed2dc6bbf9399c46686a5d3d025b617b7a15c613f019128bf0d96399
|
7
|
+
data.tar.gz: f068bdc6599cb6218c38e36ee83921cb4320c36289053bf0620324ee85705243c29474cb359a18052d4f02a22123143ba31016affa30c240ad65da240865c8c0
|
data/README.md
CHANGED
@@ -31,6 +31,12 @@ users = account.users # Find the Users associated with that account
|
|
31
31
|
pp users
|
32
32
|
```
|
33
33
|
|
34
|
+
## TODO
|
35
|
+
|
36
|
+
* Document all implemented methods
|
37
|
+
* Implement all available methods
|
38
|
+
* Add paging for collections
|
39
|
+
|
34
40
|
## Contributing
|
35
41
|
|
36
42
|
1. Fork it ( https://github.com/icehook/onsip/fork )
|
data/lib/onsip/models/account.rb
CHANGED
@@ -18,6 +18,14 @@ module OnSIP
|
|
18
18
|
User.browse self.id
|
19
19
|
end
|
20
20
|
|
21
|
+
def external_addresses
|
22
|
+
ExternalAddress.browse 'AccountId' => self.id
|
23
|
+
end
|
24
|
+
|
25
|
+
def user_addresses
|
26
|
+
UserAddress.browse 'AccountId' => self.id
|
27
|
+
end
|
28
|
+
|
21
29
|
module ClassMethods
|
22
30
|
def read(account_id)
|
23
31
|
response = OnSIP.connection.get('/api', {'Action' => 'AccountRead', 'AccountId' => account_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}, {})
|
@@ -34,31 +42,30 @@ module OnSIP
|
|
34
42
|
account
|
35
43
|
end
|
36
44
|
|
37
|
-
|
45
|
+
# TODO
|
38
46
|
def edit_contact(*args)
|
39
47
|
raise NotImplementedError
|
40
48
|
end
|
41
49
|
|
42
|
-
|
50
|
+
# TODO
|
43
51
|
def edit_add_credit(*args)
|
44
52
|
raise NotImplementedError
|
45
53
|
end
|
46
54
|
|
47
|
-
|
55
|
+
# TODO
|
48
56
|
def edit_recharge(*args)
|
49
57
|
raise NotImplementedError
|
50
58
|
end
|
51
59
|
|
52
|
-
|
60
|
+
# TODO
|
53
61
|
def invoice_read(*args)
|
54
62
|
raise NotImplementedError
|
55
63
|
end
|
56
64
|
|
57
|
-
|
65
|
+
# TODO
|
58
66
|
def invoice_browse(*args)
|
59
67
|
raise NotImplementedError
|
60
68
|
end
|
61
|
-
|
62
69
|
end
|
63
70
|
|
64
71
|
extend ClassMethods
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module OnSIP
|
2
|
+
class ExternalAddress
|
3
|
+
include Model
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
# TODO
|
7
|
+
def add(*args)
|
8
|
+
raise NotImplementedError
|
9
|
+
end
|
10
|
+
|
11
|
+
# TODO
|
12
|
+
def read(*args)
|
13
|
+
raise NotImplementedError
|
14
|
+
end
|
15
|
+
|
16
|
+
def browse(args)
|
17
|
+
params = args.merge({'Action' => 'ExternalAddressBrowse', 'SessionId' => OnSIP.session.id, 'Output' => 'json'})
|
18
|
+
response = OnSIP.connection.get('/api', params, {})
|
19
|
+
process_browse_external_address_response response
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_browse_external_address_response(response)
|
23
|
+
external_addresses = []
|
24
|
+
|
25
|
+
key_path = %w(Response Result ExternalAddressBrowse ExternalAddresses ExternalAddress)
|
26
|
+
a = ResponseParser.parse_response response, key_path
|
27
|
+
external_addresses = a.map { |h| new h } if a
|
28
|
+
|
29
|
+
external_addresses
|
30
|
+
end
|
31
|
+
|
32
|
+
# TODO
|
33
|
+
def delete(*args)
|
34
|
+
raise NotImplementedError
|
35
|
+
end
|
36
|
+
|
37
|
+
# TODO
|
38
|
+
def edit(*args)
|
39
|
+
raise NotImplementedError
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
extend ClassMethods
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/onsip/models/user.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module OnSIP
|
2
|
-
class
|
2
|
+
class UserAddress
|
3
3
|
include Model
|
4
4
|
|
5
5
|
DEFAULT_CALL_TIMEOUT = 60
|
@@ -12,10 +12,10 @@ 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
|
-
|
15
|
+
process_browse_user_address_response response
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def process_browse_user_address_response(response)
|
19
19
|
addresses = []
|
20
20
|
|
21
21
|
key_path = %w(Response Result UserAddressBrowse UserAddresses UserAddress)
|
@@ -37,10 +37,10 @@ module OnSIP
|
|
37
37
|
'Output' => 'json' })
|
38
38
|
|
39
39
|
response = OnSIP.connection.get('/api', params, {})
|
40
|
-
|
40
|
+
process_add_user_address_response response
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def process_add_user_address_response(response)
|
44
44
|
address = nil
|
45
45
|
|
46
46
|
key_path = %w(Response Result UserAddressAdd UserAddress)
|
@@ -50,17 +50,17 @@ module OnSIP
|
|
50
50
|
address
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
# TODO
|
54
54
|
def read(*args)
|
55
55
|
raise NotImplementedError
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
# TODO
|
59
59
|
def edit(*args)
|
60
60
|
raise NotImplementedError
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
# TODO
|
64
64
|
def delete(*args)
|
65
65
|
raise NotImplementedError
|
66
66
|
end
|
data/lib/onsip/version.rb
CHANGED
data/lib/onsip.rb
CHANGED
@@ -17,7 +17,8 @@ module OnSIP
|
|
17
17
|
autoload :Account, 'onsip/models/account'
|
18
18
|
autoload :User, 'onsip/models/user'
|
19
19
|
autoload :Organization, 'onsip/models/organization'
|
20
|
-
autoload :
|
20
|
+
autoload :ExternalAddress, 'onsip/models/external_address'
|
21
|
+
autoload :UserAddress, 'onsip/models/user_address'
|
21
22
|
autoload :CDR, 'onsip/models/cdr'
|
22
23
|
|
23
24
|
module ClassMethods
|
data/onsip.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = OnSIP::VERSION
|
9
9
|
spec.authors = ["Keith Larrimore"]
|
10
10
|
spec.email = ["klarrimore@icehook.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{OnSIP ruby client.}
|
12
|
+
spec.description = %q{OnSIP ruby client.}
|
13
13
|
spec.homepage = "http://icehook.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
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.5
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -262,7 +262,7 @@ dependencies:
|
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: 3.3.1
|
265
|
-
description:
|
265
|
+
description: OnSIP ruby client.
|
266
266
|
email:
|
267
267
|
- klarrimore@icehook.com
|
268
268
|
executables:
|
@@ -281,10 +281,11 @@ files:
|
|
281
281
|
- lib/onsip/exceptions.rb
|
282
282
|
- lib/onsip/model.rb
|
283
283
|
- lib/onsip/models/account.rb
|
284
|
-
- lib/onsip/models/address.rb
|
285
284
|
- lib/onsip/models/cdr.rb
|
285
|
+
- lib/onsip/models/external_address.rb
|
286
286
|
- lib/onsip/models/organization.rb
|
287
287
|
- lib/onsip/models/user.rb
|
288
|
+
- lib/onsip/models/user_address.rb
|
288
289
|
- lib/onsip/response_parser.rb
|
289
290
|
- lib/onsip/session.rb
|
290
291
|
- lib/onsip/version.rb
|
@@ -309,8 +310,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
309
310
|
version: '0'
|
310
311
|
requirements: []
|
311
312
|
rubyforge_project:
|
312
|
-
rubygems_version: 2.2.
|
313
|
+
rubygems_version: 2.2.2
|
313
314
|
signing_key:
|
314
315
|
specification_version: 4
|
315
|
-
summary:
|
316
|
+
summary: OnSIP ruby client.
|
316
317
|
test_files: []
|