asterisk-ari-client 0.0.1

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 (100) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +85 -0
  6. data/Rakefile +54 -0
  7. data/asterisk-ari-client.gemspec +32 -0
  8. data/examples/list_channels.rb +14 -0
  9. data/examples/websocket.rb +33 -0
  10. data/lib/ari.rb +12 -0
  11. data/lib/ari/client.rb +124 -0
  12. data/lib/ari/generators/api.rb +23 -0
  13. data/lib/ari/generators/attribute.rb +35 -0
  14. data/lib/ari/generators/model.rb +38 -0
  15. data/lib/ari/generators/operation.rb +43 -0
  16. data/lib/ari/generators/parameter.rb +35 -0
  17. data/lib/ari/generators/property.rb +32 -0
  18. data/lib/ari/generators/resource_generator.rb +94 -0
  19. data/lib/ari/generators/templates/model.rb.erb +36 -0
  20. data/lib/ari/generators/templates/resource.rb.erb +97 -0
  21. data/lib/ari/list_resource.rb +23 -0
  22. data/lib/ari/model.rb +26 -0
  23. data/lib/ari/models.rb +47 -0
  24. data/lib/ari/models/.DS_Store +0 -0
  25. data/lib/ari/models/application_replaced.rb +17 -0
  26. data/lib/ari/models/asterisk_info.rb +35 -0
  27. data/lib/ari/models/bridge_attended_transfer.rb +63 -0
  28. data/lib/ari/models/bridge_blind_transfer.rb +35 -0
  29. data/lib/ari/models/bridge_created.rb +23 -0
  30. data/lib/ari/models/bridge_destroyed.rb +23 -0
  31. data/lib/ari/models/bridge_merged.rb +27 -0
  32. data/lib/ari/models/build_info.rb +19 -0
  33. data/lib/ari/models/caller_id.rb +19 -0
  34. data/lib/ari/models/channel_caller_id.rb +23 -0
  35. data/lib/ari/models/channel_created.rb +23 -0
  36. data/lib/ari/models/channel_destroyed.rb +23 -0
  37. data/lib/ari/models/channel_dialplan.rb +23 -0
  38. data/lib/ari/models/channel_dtmf_received.rb +23 -0
  39. data/lib/ari/models/channel_entered_bridge.rb +27 -0
  40. data/lib/ari/models/channel_hangup_request.rb +23 -0
  41. data/lib/ari/models/channel_left_bridge.rb +27 -0
  42. data/lib/ari/models/channel_state_change.rb +23 -0
  43. data/lib/ari/models/channel_talking_finished.rb +23 -0
  44. data/lib/ari/models/channel_talking_started.rb +23 -0
  45. data/lib/ari/models/channel_userevent.rb +35 -0
  46. data/lib/ari/models/channel_varset.rb +23 -0
  47. data/lib/ari/models/config_info.rb +27 -0
  48. data/lib/ari/models/device_state_changed.rb +23 -0
  49. data/lib/ari/models/dial.rb +31 -0
  50. data/lib/ari/models/dialed.rb +17 -0
  51. data/lib/ari/models/dialplan_cep.rb +19 -0
  52. data/lib/ari/models/endpoint_state_change.rb +23 -0
  53. data/lib/ari/models/format_lang_pair.rb +19 -0
  54. data/lib/ari/models/live_recording.rb +19 -0
  55. data/lib/ari/models/message.rb +19 -0
  56. data/lib/ari/models/missing_params.rb +19 -0
  57. data/lib/ari/models/playback_finished.rb +23 -0
  58. data/lib/ari/models/playback_started.rb +23 -0
  59. data/lib/ari/models/recording_failed.rb +23 -0
  60. data/lib/ari/models/recording_finished.rb +23 -0
  61. data/lib/ari/models/recording_started.rb +23 -0
  62. data/lib/ari/models/set_id.rb +19 -0
  63. data/lib/ari/models/stasis_end.rb +23 -0
  64. data/lib/ari/models/stasis_start.rb +27 -0
  65. data/lib/ari/models/status_info.rb +27 -0
  66. data/lib/ari/models/stored_recording.rb +19 -0
  67. data/lib/ari/models/system_info.rb +19 -0
  68. data/lib/ari/models/text_message.rb +23 -0
  69. data/lib/ari/models/text_message_received.rb +27 -0
  70. data/lib/ari/models/text_message_variable.rb +19 -0
  71. data/lib/ari/models/variable.rb +19 -0
  72. data/lib/ari/request_error.rb +8 -0
  73. data/lib/ari/resource.rb +37 -0
  74. data/lib/ari/resources.rb +11 -0
  75. data/lib/ari/resources/application.rb +101 -0
  76. data/lib/ari/resources/asterisk.rb +72 -0
  77. data/lib/ari/resources/bridge.rb +286 -0
  78. data/lib/ari/resources/channel.rb +610 -0
  79. data/lib/ari/resources/device_state.rb +98 -0
  80. data/lib/ari/resources/endpoint.rb +124 -0
  81. data/lib/ari/resources/event.rb +25 -0
  82. data/lib/ari/resources/mailbox.rb +99 -0
  83. data/lib/ari/resources/playback.rb +86 -0
  84. data/lib/ari/resources/recording.rb +241 -0
  85. data/lib/ari/resources/sound.rb +64 -0
  86. data/lib/ari/server_error.rb +8 -0
  87. data/lib/asterisk/ari/client.rb +10 -0
  88. data/lib/asterisk/ari/client/version.rb +7 -0
  89. data/test/fixtures/bridge_create.json +74 -0
  90. data/test/fixtures/bridge_get.json +74 -0
  91. data/test/fixtures/bridges_list.json +76 -0
  92. data/test/fixtures/channel_get.json +83 -0
  93. data/test/fixtures/channel_originate.json +83 -0
  94. data/test/fixtures/channel_originate_with_id.json +83 -0
  95. data/test/fixtures/channels_list.json +105 -0
  96. data/test/lib/asterisk-ari-client/.DS_Store +0 -0
  97. data/test/lib/asterisk-ari-client/bridge_test.rb +46 -0
  98. data/test/lib/asterisk-ari-client/channel_test.rb +59 -0
  99. data/test/test_helper.rb +42 -0
  100. metadata +265 -0
@@ -0,0 +1,98 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class DeviceState < Resource
14
+
15
+ attr_reader :name, :state
16
+
17
+
18
+ # GET /deviceStates
19
+ #
20
+ # Device states
21
+ #
22
+ #
23
+ def self.list(options = {})
24
+ path = '/deviceStates'
25
+ response = client(options).get(path, options)
26
+ response.map { |hash| DeviceState.new(hash.merge(client: options[:client])) }
27
+ end
28
+
29
+ # GET /deviceStates/%{deviceName}
30
+ #
31
+ # Device state
32
+ #
33
+ #
34
+ # Parameters:
35
+ #
36
+ # deviceName (required) - Name of the device
37
+ #
38
+ def self.get(options = {})
39
+ raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
40
+ path = '/deviceStates/%{deviceName}' % options
41
+ response = client(options).get(path, options)
42
+ DeviceState.new(response.merge(client: options[:client]))
43
+ end
44
+
45
+ def get(options = {})
46
+ self.class.get(options.merge(deviceStateId: self.id, client: @client))
47
+ end
48
+
49
+ # PUT /deviceStates/%{deviceName}
50
+ #
51
+ # Device state
52
+ #
53
+ # Change the state of a device controlled by ARI. (Note - implicitly creates the d
54
+ #
55
+ # Parameters:
56
+ #
57
+ # deviceName (required) - Name of the device
58
+ # deviceState (required) - Device state value
59
+ #
60
+ def self.update(options = {})
61
+ raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
62
+ raise ArgumentError.new("Parameter deviceState must be passed in options hash.") unless options[:deviceState]
63
+ path = '/deviceStates/%{deviceName}' % options
64
+ response = client(options).put(path, options)
65
+ end
66
+
67
+ def update(options = {})
68
+ self.class.update(options.merge(deviceStateId: self.id, client: @client))
69
+ end
70
+
71
+ # DELETE /deviceStates/%{deviceName}
72
+ #
73
+ # Device state
74
+ #
75
+ #
76
+ # Parameters:
77
+ #
78
+ # deviceName (required) - Name of the device
79
+ #
80
+ def self.delete(options = {})
81
+ raise ArgumentError.new("Parameter deviceName must be passed in options hash.") unless options[:deviceName]
82
+ path = '/deviceStates/%{deviceName}' % options
83
+ response = client(options).delete(path, options)
84
+ rescue Ari::RequestError => e
85
+ raise unless e.code == '404'
86
+ end
87
+
88
+ def delete(options = {})
89
+ self.class.delete(options.merge(deviceStateId: self.id, client: @client))
90
+ end
91
+
92
+
93
+ end
94
+ end
95
+
96
+ Ari::Client.send :define_method, 'device_states' do
97
+ Ari::ListResource.new(self, Ari::DeviceState)
98
+ end
@@ -0,0 +1,124 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class Endpoint < Resource
14
+
15
+ attr_reader :technology, :resource, :state, :channel_ids
16
+
17
+
18
+ # GET /endpoints
19
+ #
20
+ # Asterisk endpoints
21
+ #
22
+ #
23
+ def self.list(options = {})
24
+ path = '/endpoints'
25
+ response = client(options).get(path, options)
26
+ response.map { |hash| Endpoint.new(hash.merge(client: options[:client])) }
27
+ end
28
+
29
+ # PUT /endpoints/sendMessage
30
+ #
31
+ # Send a message to some technology URI or endpoint.
32
+ #
33
+ #
34
+ # Parameters:
35
+ #
36
+ # to (required) - The endpoint resource or technology specific URI to send the message to. Valid resources are sip, pjsip, and xmpp.
37
+ # from (required) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp.
38
+ # body - The body of the message
39
+ # variables -
40
+ #
41
+ def self.send_message(options = {})
42
+ raise ArgumentError.new("Parameter to must be passed in options hash.") unless options[:to]
43
+ raise ArgumentError.new("Parameter from must be passed in options hash.") unless options[:from]
44
+ path = '/endpoints/sendMessage'
45
+ response = client(options).put(path, options)
46
+ end
47
+ class << self; alias_method :sendMessage, :send_message; end
48
+
49
+ # GET /endpoints/%{tech}
50
+ #
51
+ # Asterisk endpoints
52
+ #
53
+ #
54
+ # Parameters:
55
+ #
56
+ # tech (required) - Technology of the endpoints (sip,iax2,...)
57
+ #
58
+ def self.list_by_tech(options = {})
59
+ raise ArgumentError.new("Parameter tech must be passed in options hash.") unless options[:tech]
60
+ path = '/endpoints/%{tech}' % options
61
+ response = client(options).get(path, options)
62
+ response.map { |hash| Endpoint.new(hash.merge(client: options[:client])) }
63
+ end
64
+ class << self; alias_method :listByTech, :list_by_tech; end
65
+
66
+ def list_by_tech(options = {})
67
+ self.class.list_by_tech(options.merge(endpointId: self.id, client: @client))
68
+ end
69
+
70
+ # GET /endpoints/%{tech}/%{resource}
71
+ #
72
+ # Single endpoint
73
+ #
74
+ #
75
+ # Parameters:
76
+ #
77
+ # tech (required) - Technology of the endpoint
78
+ # resource (required) - ID of the endpoint
79
+ #
80
+ def self.get(options = {})
81
+ raise ArgumentError.new("Parameter tech must be passed in options hash.") unless options[:tech]
82
+ raise ArgumentError.new("Parameter resource must be passed in options hash.") unless options[:resource]
83
+ path = '/endpoints/%{tech}/%{resource}' % options
84
+ response = client(options).get(path, options)
85
+ Endpoint.new(response.merge(client: options[:client]))
86
+ end
87
+
88
+ def get(options = {})
89
+ self.class.get(options.merge(endpointId: self.id, client: @client))
90
+ end
91
+
92
+ # PUT /endpoints/%{tech}/%{resource}/sendMessage
93
+ #
94
+ # Send a message to some endpoint in a technology.
95
+ #
96
+ #
97
+ # Parameters:
98
+ #
99
+ # tech (required) - Technology of the endpoint
100
+ # resource (required) - ID of the endpoint
101
+ # from (required) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp.
102
+ # body - The body of the message
103
+ # variables -
104
+ #
105
+ def self.send_message_to_endpoint(options = {})
106
+ raise ArgumentError.new("Parameter tech must be passed in options hash.") unless options[:tech]
107
+ raise ArgumentError.new("Parameter resource must be passed in options hash.") unless options[:resource]
108
+ raise ArgumentError.new("Parameter from must be passed in options hash.") unless options[:from]
109
+ path = '/endpoints/%{tech}/%{resource}/sendMessage' % options
110
+ response = client(options).put(path, options)
111
+ end
112
+ class << self; alias_method :sendMessageToEndpoint, :send_message_to_endpoint; end
113
+
114
+ def send_message_to_endpoint(options = {})
115
+ self.class.send_message_to_endpoint(options.merge(endpointId: self.id, client: @client))
116
+ end
117
+
118
+
119
+ end
120
+ end
121
+
122
+ Ari::Client.send :define_method, 'endpoints' do
123
+ Ari::ListResource.new(self, Ari::Endpoint)
124
+ end
@@ -0,0 +1,25 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class Event < Model
14
+
15
+ attr_reader :application, :timestamp
16
+
17
+ def timestamp=(val)
18
+ @timestamp ||= Time.parse(val)
19
+ end
20
+
21
+
22
+
23
+ end
24
+ end
25
+
@@ -0,0 +1,99 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class Mailbox < Resource
14
+
15
+ attr_reader :name, :old_messages, :new_messages
16
+
17
+
18
+ # GET /mailboxes
19
+ #
20
+ # Mailboxes
21
+ #
22
+ #
23
+ def self.list(options = {})
24
+ path = '/mailboxes'
25
+ response = client(options).get(path, options)
26
+ response.map { |hash| Mailbox.new(hash.merge(client: options[:client])) }
27
+ end
28
+
29
+ # GET /mailboxes/%{mailboxName}
30
+ #
31
+ # Mailbox state
32
+ #
33
+ #
34
+ # Parameters:
35
+ #
36
+ # mailboxName (required) - Name of the mailbox
37
+ #
38
+ def self.get(options = {})
39
+ raise ArgumentError.new("Parameter mailboxName must be passed in options hash.") unless options[:mailboxName]
40
+ path = '/mailboxes/%{mailboxName}' % options
41
+ response = client(options).get(path, options)
42
+ Mailbox.new(response.merge(client: options[:client]))
43
+ end
44
+
45
+ def get(options = {})
46
+ self.class.get(options.merge(mailboxId: self.id, client: @client))
47
+ end
48
+
49
+ # PUT /mailboxes/%{mailboxName}
50
+ #
51
+ # Mailbox state
52
+ #
53
+ #
54
+ # Parameters:
55
+ #
56
+ # mailboxName (required) - Name of the mailbox
57
+ # oldMessages (required) - Count of old messages in the mailbox
58
+ # newMessages (required) - Count of new messages in the mailbox
59
+ #
60
+ def self.update(options = {})
61
+ raise ArgumentError.new("Parameter mailboxName must be passed in options hash.") unless options[:mailboxName]
62
+ raise ArgumentError.new("Parameter oldMessages must be passed in options hash.") unless options[:oldMessages]
63
+ raise ArgumentError.new("Parameter newMessages must be passed in options hash.") unless options[:newMessages]
64
+ path = '/mailboxes/%{mailboxName}' % options
65
+ response = client(options).put(path, options)
66
+ end
67
+
68
+ def update(options = {})
69
+ self.class.update(options.merge(mailboxId: self.id, client: @client))
70
+ end
71
+
72
+ # DELETE /mailboxes/%{mailboxName}
73
+ #
74
+ # Mailbox state
75
+ #
76
+ #
77
+ # Parameters:
78
+ #
79
+ # mailboxName (required) - Name of the mailbox
80
+ #
81
+ def self.delete(options = {})
82
+ raise ArgumentError.new("Parameter mailboxName must be passed in options hash.") unless options[:mailboxName]
83
+ path = '/mailboxes/%{mailboxName}' % options
84
+ response = client(options).delete(path, options)
85
+ rescue Ari::RequestError => e
86
+ raise unless e.code == '404'
87
+ end
88
+
89
+ def delete(options = {})
90
+ self.class.delete(options.merge(mailboxId: self.id, client: @client))
91
+ end
92
+
93
+
94
+ end
95
+ end
96
+
97
+ Ari::Client.send :define_method, 'mailboxes' do
98
+ Ari::ListResource.new(self, Ari::Mailbox)
99
+ end
@@ -0,0 +1,86 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class Playback < Resource
14
+
15
+ attr_reader :id, :media_uri, :target_uri, :language, :state
16
+
17
+
18
+ # GET /playbacks/%{playbackId}
19
+ #
20
+ # Control object for a playback operation.
21
+ #
22
+ #
23
+ # Parameters:
24
+ #
25
+ # playbackId (required) - Playback's id
26
+ #
27
+ def self.get(options = {})
28
+ raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
29
+ path = '/playbacks/%{playbackId}' % options
30
+ response = client(options).get(path, options)
31
+ Playback.new(response.merge(client: options[:client]))
32
+ end
33
+
34
+ def get(options = {})
35
+ self.class.get(options.merge(playbackId: self.id, client: @client))
36
+ end
37
+
38
+ # DELETE /playbacks/%{playbackId}
39
+ #
40
+ # Control object for a playback operation.
41
+ #
42
+ #
43
+ # Parameters:
44
+ #
45
+ # playbackId (required) - Playback's id
46
+ #
47
+ def self.stop(options = {})
48
+ raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
49
+ path = '/playbacks/%{playbackId}' % options
50
+ response = client(options).delete(path, options)
51
+ rescue Ari::RequestError => e
52
+ raise unless e.code == '404'
53
+ end
54
+
55
+ def stop(options = {})
56
+ self.class.stop(options.merge(playbackId: self.id, client: @client))
57
+ end
58
+
59
+ # POST /playbacks/%{playbackId}/control
60
+ #
61
+ # Control object for a playback operation.
62
+ #
63
+ #
64
+ # Parameters:
65
+ #
66
+ # playbackId (required) - Playback's id
67
+ # operation (required) - Operation to perform on the playback.
68
+ #
69
+ def self.control(options = {})
70
+ raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
71
+ raise ArgumentError.new("Parameter operation must be passed in options hash.") unless options[:operation]
72
+ path = '/playbacks/%{playbackId}/control' % options
73
+ response = client(options).post(path, options)
74
+ end
75
+
76
+ def control(options = {})
77
+ self.class.control(options.merge(playbackId: self.id, client: @client))
78
+ end
79
+
80
+
81
+ end
82
+ end
83
+
84
+ Ari::Client.send :define_method, 'playbacks' do
85
+ Ari::ListResource.new(self, Ari::Playback)
86
+ end
@@ -0,0 +1,241 @@
1
+ #------------------------------------------------------------------------------
2
+ #
3
+ # WARNING !
4
+ #
5
+ # This is a generated file. DO NOT EDIT THIS FILE! Your changes will
6
+ # be lost the next time this file is regenerated.
7
+ #
8
+ # This file was generated using asterisk-ari-client ruby gem.
9
+ #
10
+ #------------------------------------------------------------------------------
11
+
12
+ module Ari
13
+ class Recording < Resource
14
+
15
+
16
+ # GET /recordings/stored
17
+ #
18
+ # Recordings
19
+ #
20
+ #
21
+ def self.list_stored(options = {})
22
+ path = '/recordings/stored'
23
+ response = client(options).get(path, options)
24
+ response.map { |hash| StoredRecording.new(hash.merge(client: options[:client])) }
25
+ end
26
+ class << self; alias_method :listStored, :list_stored; end
27
+
28
+ # GET /recordings/stored/%{recordingName}
29
+ #
30
+ # Individual recording
31
+ #
32
+ #
33
+ # Parameters:
34
+ #
35
+ # recordingName (required) - The name of the recording
36
+ #
37
+ def self.get_stored(options = {})
38
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
39
+ path = '/recordings/stored/%{recordingName}' % options
40
+ response = client(options).get(path, options)
41
+ StoredRecording.new(response.merge(client: options[:client]))
42
+ end
43
+ class << self; alias_method :getStored, :get_stored; end
44
+
45
+ def get_stored(options = {})
46
+ self.class.get_stored(options.merge(recordingId: self.id, client: @client))
47
+ end
48
+
49
+ # DELETE /recordings/stored/%{recordingName}
50
+ #
51
+ # Individual recording
52
+ #
53
+ #
54
+ # Parameters:
55
+ #
56
+ # recordingName (required) - The name of the recording
57
+ #
58
+ def self.delete_stored(options = {})
59
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
60
+ path = '/recordings/stored/%{recordingName}' % options
61
+ response = client(options).delete(path, options)
62
+ rescue Ari::RequestError => e
63
+ raise unless e.code == '404'
64
+ end
65
+ class << self; alias_method :deleteStored, :delete_stored; end
66
+
67
+ def delete_stored(options = {})
68
+ self.class.delete_stored(options.merge(recordingId: self.id, client: @client))
69
+ end
70
+
71
+ # POST /recordings/stored/%{recordingName}/copy
72
+ #
73
+ # Copy an individual recording
74
+ #
75
+ #
76
+ # Parameters:
77
+ #
78
+ # recordingName (required) - The name of the recording to copy
79
+ # destinationRecordingName (required) - The destination name of the recording
80
+ #
81
+ def self.copy_stored(options = {})
82
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
83
+ raise ArgumentError.new("Parameter destinationRecordingName must be passed in options hash.") unless options[:destinationRecordingName]
84
+ path = '/recordings/stored/%{recordingName}/copy' % options
85
+ response = client(options).post(path, options)
86
+ StoredRecording.new(response.merge(client: options[:client]))
87
+ end
88
+ class << self; alias_method :copyStored, :copy_stored; end
89
+
90
+ def copy_stored(options = {})
91
+ self.class.copy_stored(options.merge(recordingId: self.id, client: @client))
92
+ end
93
+
94
+ # GET /recordings/live/%{recordingName}
95
+ #
96
+ # A recording that is in progress
97
+ #
98
+ #
99
+ # Parameters:
100
+ #
101
+ # recordingName (required) - The name of the recording
102
+ #
103
+ def self.get_live(options = {})
104
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
105
+ path = '/recordings/live/%{recordingName}' % options
106
+ response = client(options).get(path, options)
107
+ LiveRecording.new(response.merge(client: options[:client]))
108
+ end
109
+ class << self; alias_method :getLive, :get_live; end
110
+
111
+ def get_live(options = {})
112
+ self.class.get_live(options.merge(recordingId: self.id, client: @client))
113
+ end
114
+
115
+ # DELETE /recordings/live/%{recordingName}
116
+ #
117
+ # A recording that is in progress
118
+ #
119
+ #
120
+ # Parameters:
121
+ #
122
+ # recordingName (required) - The name of the recording
123
+ #
124
+ def self.cancel(options = {})
125
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
126
+ path = '/recordings/live/%{recordingName}' % options
127
+ response = client(options).delete(path, options)
128
+ rescue Ari::RequestError => e
129
+ raise unless e.code == '404'
130
+ end
131
+
132
+ def cancel(options = {})
133
+ self.class.cancel(options.merge(recordingId: self.id, client: @client))
134
+ end
135
+
136
+ # POST /recordings/live/%{recordingName}/stop
137
+ #
138
+ #
139
+ #
140
+ #
141
+ # Parameters:
142
+ #
143
+ # recordingName (required) - The name of the recording
144
+ #
145
+ def self.stop(options = {})
146
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
147
+ path = '/recordings/live/%{recordingName}/stop' % options
148
+ response = client(options).post(path, options)
149
+ end
150
+
151
+ def stop(options = {})
152
+ self.class.stop(options.merge(recordingId: self.id, client: @client))
153
+ end
154
+
155
+ # POST /recordings/live/%{recordingName}/pause
156
+ #
157
+ #
158
+ #
159
+ #
160
+ # Parameters:
161
+ #
162
+ # recordingName (required) - The name of the recording
163
+ #
164
+ def self.pause(options = {})
165
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
166
+ path = '/recordings/live/%{recordingName}/pause' % options
167
+ response = client(options).post(path, options)
168
+ end
169
+
170
+ def pause(options = {})
171
+ self.class.pause(options.merge(recordingId: self.id, client: @client))
172
+ end
173
+
174
+ # DELETE /recordings/live/%{recordingName}/pause
175
+ #
176
+ #
177
+ #
178
+ #
179
+ # Parameters:
180
+ #
181
+ # recordingName (required) - The name of the recording
182
+ #
183
+ def self.unpause(options = {})
184
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
185
+ path = '/recordings/live/%{recordingName}/pause' % options
186
+ response = client(options).delete(path, options)
187
+ rescue Ari::RequestError => e
188
+ raise unless e.code == '404'
189
+ end
190
+
191
+ def unpause(options = {})
192
+ self.class.unpause(options.merge(recordingId: self.id, client: @client))
193
+ end
194
+
195
+ # POST /recordings/live/%{recordingName}/mute
196
+ #
197
+ #
198
+ #
199
+ #
200
+ # Parameters:
201
+ #
202
+ # recordingName (required) - The name of the recording
203
+ #
204
+ def self.mute(options = {})
205
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
206
+ path = '/recordings/live/%{recordingName}/mute' % options
207
+ response = client(options).post(path, options)
208
+ end
209
+
210
+ def mute(options = {})
211
+ self.class.mute(options.merge(recordingId: self.id, client: @client))
212
+ end
213
+
214
+ # DELETE /recordings/live/%{recordingName}/mute
215
+ #
216
+ #
217
+ #
218
+ #
219
+ # Parameters:
220
+ #
221
+ # recordingName (required) - The name of the recording
222
+ #
223
+ def self.unmute(options = {})
224
+ raise ArgumentError.new("Parameter recordingName must be passed in options hash.") unless options[:recordingName]
225
+ path = '/recordings/live/%{recordingName}/mute' % options
226
+ response = client(options).delete(path, options)
227
+ rescue Ari::RequestError => e
228
+ raise unless e.code == '404'
229
+ end
230
+
231
+ def unmute(options = {})
232
+ self.class.unmute(options.merge(recordingId: self.id, client: @client))
233
+ end
234
+
235
+
236
+ end
237
+ end
238
+
239
+ Ari::Client.send :define_method, 'recordings' do
240
+ Ari::ListResource.new(self, Ari::Recording)
241
+ end