voiceml 0.9.2 → 0.9.3
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 +17 -13
- data/lib/voiceml/client.rb +53 -13
- data/lib/voiceml/errors.rb +15 -2
- data/lib/voiceml/models/accounts.rb +47 -3
- data/lib/voiceml/models/applications.rb +6 -0
- data/lib/voiceml/models/assistants_v1.rb +40 -0
- data/lib/voiceml/models/calls.rb +4 -0
- data/lib/voiceml/models/common.rb +35 -4
- data/lib/voiceml/models/conferences.rb +8 -0
- data/lib/voiceml/models/conversations_v1.rb +131 -29
- data/lib/voiceml/models/diagnostics.rb +33 -12
- data/lib/voiceml/models/exports.rb +58 -0
- data/lib/voiceml/models/incoming_phone_numbers.rb +4 -0
- data/lib/voiceml/models/media.rb +4 -0
- data/lib/voiceml/models/messages.rb +29 -0
- data/lib/voiceml/models/messaging_v1.rb +35 -2
- data/lib/voiceml/models/monitor_v1.rb +54 -0
- data/lib/voiceml/models/notifications.rb +2 -0
- data/lib/voiceml/models/outgoing_caller_ids.rb +6 -0
- data/lib/voiceml/models/payments.rb +2 -0
- data/lib/voiceml/models/pricing.rb +38 -4
- data/lib/voiceml/models/queues.rb +8 -0
- data/lib/voiceml/models/recordings.rb +5 -1
- data/lib/voiceml/models/routes_v2.rb +6 -2
- data/lib/voiceml/models/sip.rb +34 -6
- data/lib/voiceml/models/sip_registrations.rb +49 -0
- data/lib/voiceml/models/siprec.rb +5 -17
- data/lib/voiceml/models/streams.rb +4 -16
- data/lib/voiceml/models/transcriptions.rb +35 -4
- data/lib/voiceml/models/usage_records.rb +48 -0
- data/lib/voiceml/models/user_defined_messages.rb +2 -0
- data/lib/voiceml/models/voice_v1.rb +29 -19
- data/lib/voiceml/request_validator.rb +125 -0
- data/lib/voiceml/resources/accounts.rb +75 -0
- data/lib/voiceml/resources/applications.rb +3 -1
- data/lib/voiceml/resources/assistants_v1.rb +53 -77
- data/lib/voiceml/resources/base.rb +138 -16
- data/lib/voiceml/resources/calls.rb +34 -49
- data/lib/voiceml/resources/conferences.rb +26 -5
- data/lib/voiceml/resources/conversations_v1.rb +147 -172
- data/lib/voiceml/resources/diagnostics.rb +20 -35
- data/lib/voiceml/resources/exports.rb +36 -0
- data/lib/voiceml/resources/incoming_phone_numbers.rb +53 -32
- data/lib/voiceml/resources/messages.rb +79 -15
- data/lib/voiceml/resources/messaging_v1.rb +47 -13
- data/lib/voiceml/resources/monitor_v1.rb +68 -0
- data/lib/voiceml/resources/notifications.rb +1 -1
- data/lib/voiceml/resources/outgoing_caller_ids.rb +77 -0
- data/lib/voiceml/resources/pricing.rb +13 -5
- data/lib/voiceml/resources/queues.rb +6 -5
- data/lib/voiceml/resources/recordings.rb +39 -5
- data/lib/voiceml/resources/routes_v2.rb +10 -4
- data/lib/voiceml/resources/sip.rb +30 -11
- data/lib/voiceml/resources/transcriptions.rb +40 -0
- data/lib/voiceml/resources/usage_records.rb +51 -0
- data/lib/voiceml/resources/voice_v1.rb +31 -38
- data/lib/voiceml/transport.rb +277 -230
- data/lib/voiceml/version.rb +1 -1
- data/lib/voiceml.rb +14 -15
- metadata +18 -6
|
@@ -5,6 +5,7 @@ require_relative 'common'
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# A Twilio-compatible Queue resource.
|
|
7
7
|
class Queue
|
|
8
|
+
include RawAttributes
|
|
8
9
|
ATTRIBUTES = %w[
|
|
9
10
|
sid account_sid friendly_name current_size max_size
|
|
10
11
|
average_wait_time date_created date_updated uri
|
|
@@ -13,6 +14,7 @@ module VoiceML
|
|
|
13
14
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
14
15
|
|
|
15
16
|
def initialize(attrs = {})
|
|
17
|
+
@raw_attributes = attrs
|
|
16
18
|
ATTRIBUTES.each do |field|
|
|
17
19
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
18
20
|
instance_variable_set("@#{field}", value)
|
|
@@ -28,11 +30,13 @@ module VoiceML
|
|
|
28
30
|
|
|
29
31
|
# Paginated `GET /Queues` response.
|
|
30
32
|
class QueueList
|
|
33
|
+
include RawAttributes
|
|
31
34
|
include Pageable
|
|
32
35
|
|
|
33
36
|
attr_reader :queues
|
|
34
37
|
|
|
35
38
|
def initialize(hash = {})
|
|
39
|
+
@raw_attributes = hash
|
|
36
40
|
assign_page_fields(hash)
|
|
37
41
|
@queues = (hash['queues'] || []).map { |q| Queue.from_hash(q) }
|
|
38
42
|
end
|
|
@@ -44,6 +48,7 @@ module VoiceML
|
|
|
44
48
|
|
|
45
49
|
# A member (call) waiting in a queue.
|
|
46
50
|
class QueueMember
|
|
51
|
+
include RawAttributes
|
|
47
52
|
ATTRIBUTES = %w[
|
|
48
53
|
call_sid queue_sid account_sid date_enqueued wait_time position uri
|
|
49
54
|
].freeze
|
|
@@ -51,6 +56,7 @@ module VoiceML
|
|
|
51
56
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
52
57
|
|
|
53
58
|
def initialize(attrs = {})
|
|
59
|
+
@raw_attributes = attrs
|
|
54
60
|
ATTRIBUTES.each do |field|
|
|
55
61
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
56
62
|
instance_variable_set("@#{field}", value)
|
|
@@ -66,11 +72,13 @@ module VoiceML
|
|
|
66
72
|
|
|
67
73
|
# Paginated `GET /Queues/{Sid}/Members` response.
|
|
68
74
|
class QueueMemberList
|
|
75
|
+
include RawAttributes
|
|
69
76
|
include Pageable
|
|
70
77
|
|
|
71
78
|
attr_reader :queue_members
|
|
72
79
|
|
|
73
80
|
def initialize(hash = {})
|
|
81
|
+
@raw_attributes = hash
|
|
74
82
|
assign_page_fields(hash)
|
|
75
83
|
@queue_members = (hash['queue_members'] || []).map { |m| QueueMember.from_hash(m) }
|
|
76
84
|
end
|
|
@@ -5,15 +5,17 @@ require_relative 'common'
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# A Twilio-compatible Recording resource.
|
|
7
7
|
class Recording
|
|
8
|
+
include RawAttributes
|
|
8
9
|
ATTRIBUTES = %w[
|
|
9
10
|
sid account_sid call_sid conference_sid status source channels
|
|
10
11
|
duration api_version uri date_created date_updated start_time
|
|
11
|
-
price price_unit encryption_details subresource_uris media_url error_code
|
|
12
|
+
price price_unit encryption_details subresource_uris media_url error_code track
|
|
12
13
|
].freeze
|
|
13
14
|
|
|
14
15
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
15
16
|
|
|
16
17
|
def initialize(attrs = {})
|
|
18
|
+
@raw_attributes = attrs
|
|
17
19
|
ATTRIBUTES.each do |field|
|
|
18
20
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
19
21
|
instance_variable_set("@#{field}", value)
|
|
@@ -30,11 +32,13 @@ module VoiceML
|
|
|
30
32
|
# `GET /Recordings` (account-scoped) and `GET /Calls/{Sid}/Recordings` (per-call) response.
|
|
31
33
|
# The per-call form populates only `recordings`; pagination fields remain `nil`.
|
|
32
34
|
class RecordingList
|
|
35
|
+
include RawAttributes
|
|
33
36
|
include Pageable
|
|
34
37
|
|
|
35
38
|
attr_reader :recordings
|
|
36
39
|
|
|
37
40
|
def initialize(hash = {})
|
|
41
|
+
@raw_attributes = hash
|
|
38
42
|
assign_page_fields(hash)
|
|
39
43
|
@recordings = (hash['recordings'] || []).map { |r| Recording.from_hash(r) }
|
|
40
44
|
end
|
|
@@ -4,13 +4,15 @@ module VoiceML
|
|
|
4
4
|
# Twilio routes/v2 Inbound Processing Region binding. SID is `QQ...`.
|
|
5
5
|
# Keyed by SIP domain name (not the SipDomain SID).
|
|
6
6
|
class RoutesV2SipDomain
|
|
7
|
+
include RawAttributes
|
|
7
8
|
ATTRIBUTES = %w[
|
|
8
9
|
sid sip_domain account_sid friendly_name voice_region url
|
|
9
10
|
date_created date_updated
|
|
10
11
|
].freeze
|
|
11
12
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
12
13
|
def initialize(attrs = {})
|
|
13
|
-
|
|
14
|
+
@raw_attributes = attrs
|
|
15
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
14
16
|
end
|
|
15
17
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
16
18
|
end
|
|
@@ -18,13 +20,15 @@ module VoiceML
|
|
|
18
20
|
# Twilio routes/v2 Inbound Processing Region binding for a claimed phone number.
|
|
19
21
|
# Keyed by E.164 phone number or its PN sid; account resolved from HTTP Basic auth.
|
|
20
22
|
class RoutesV2PhoneNumber
|
|
23
|
+
include RawAttributes
|
|
21
24
|
ATTRIBUTES = %w[
|
|
22
25
|
sid phone_number account_sid friendly_name voice_region url
|
|
23
26
|
date_created date_updated
|
|
24
27
|
].freeze
|
|
25
28
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
26
29
|
def initialize(attrs = {})
|
|
27
|
-
|
|
30
|
+
@raw_attributes = attrs
|
|
31
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
28
32
|
end
|
|
29
33
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
30
34
|
end
|
data/lib/voiceml/models/sip.rb
CHANGED
|
@@ -15,6 +15,7 @@ module VoiceML
|
|
|
15
15
|
|
|
16
16
|
# SipDomain — `SD...` resource.
|
|
17
17
|
class SipDomain
|
|
18
|
+
include RawAttributes
|
|
18
19
|
ATTRIBUTES = %w[
|
|
19
20
|
sid account_sid domain_name api_version friendly_name auth_type
|
|
20
21
|
voice_url voice_method voice_fallback_url voice_fallback_method
|
|
@@ -25,15 +26,18 @@ module VoiceML
|
|
|
25
26
|
].freeze
|
|
26
27
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
27
28
|
def initialize(attrs = {})
|
|
28
|
-
|
|
29
|
+
@raw_attributes = attrs
|
|
30
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
29
31
|
end
|
|
30
32
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
class SipDomainList
|
|
36
|
+
include RawAttributes
|
|
34
37
|
include Pageable
|
|
35
38
|
attr_reader :domains
|
|
36
39
|
def initialize(hash = {})
|
|
40
|
+
@raw_attributes = hash
|
|
37
41
|
assign_page_fields(hash)
|
|
38
42
|
@domains = (hash['domains'] || []).map { |h| SipDomain.from_hash(h) }
|
|
39
43
|
end
|
|
@@ -42,20 +46,24 @@ module VoiceML
|
|
|
42
46
|
|
|
43
47
|
# SipCredentialList — `CL...`.
|
|
44
48
|
class SipCredentialList
|
|
49
|
+
include RawAttributes
|
|
45
50
|
ATTRIBUTES = %w[
|
|
46
51
|
sid account_sid friendly_name date_created date_updated uri subresource_uris
|
|
47
52
|
].freeze
|
|
48
53
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
49
54
|
def initialize(attrs = {})
|
|
50
|
-
|
|
55
|
+
@raw_attributes = attrs
|
|
56
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
51
57
|
end
|
|
52
58
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
53
59
|
end
|
|
54
60
|
|
|
55
61
|
class SipCredentialListList
|
|
62
|
+
include RawAttributes
|
|
56
63
|
include Pageable
|
|
57
64
|
attr_reader :credential_lists
|
|
58
65
|
def initialize(hash = {})
|
|
66
|
+
@raw_attributes = hash
|
|
59
67
|
assign_page_fields(hash)
|
|
60
68
|
@credential_lists = (hash['credential_lists'] || []).map { |h| SipCredentialList.from_hash(h) }
|
|
61
69
|
end
|
|
@@ -64,13 +72,15 @@ module VoiceML
|
|
|
64
72
|
|
|
65
73
|
# SipCredential — `CR...`. Password is write-only (never returned).
|
|
66
74
|
class SipCredential
|
|
75
|
+
include RawAttributes
|
|
67
76
|
ATTRIBUTES = %w[
|
|
68
77
|
sid account_sid credential_list_sid username
|
|
69
78
|
date_created date_updated uri
|
|
70
79
|
].freeze
|
|
71
80
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
72
81
|
def initialize(attrs = {})
|
|
73
|
-
|
|
82
|
+
@raw_attributes = attrs
|
|
83
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
74
84
|
end
|
|
75
85
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
76
86
|
end
|
|
@@ -78,9 +88,11 @@ module VoiceML
|
|
|
78
88
|
# SipCredentialListPage — spec name is `SipCredentialListPage` but it's a page of
|
|
79
89
|
# CREDENTIALS (not credential-lists), mirroring Twilio.
|
|
80
90
|
class SipCredentialListPage
|
|
91
|
+
include RawAttributes
|
|
81
92
|
include Pageable
|
|
82
93
|
attr_reader :credentials
|
|
83
94
|
def initialize(hash = {})
|
|
95
|
+
@raw_attributes = hash
|
|
84
96
|
assign_page_fields(hash)
|
|
85
97
|
@credentials = (hash['credentials'] || []).map { |h| SipCredential.from_hash(h) }
|
|
86
98
|
end
|
|
@@ -89,20 +101,24 @@ module VoiceML
|
|
|
89
101
|
|
|
90
102
|
# SipIpAccessControlList — `AL...`.
|
|
91
103
|
class SipIpAccessControlList
|
|
104
|
+
include RawAttributes
|
|
92
105
|
ATTRIBUTES = %w[
|
|
93
106
|
sid account_sid friendly_name date_created date_updated uri subresource_uris
|
|
94
107
|
].freeze
|
|
95
108
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
96
109
|
def initialize(attrs = {})
|
|
97
|
-
|
|
110
|
+
@raw_attributes = attrs
|
|
111
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
98
112
|
end
|
|
99
113
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
100
114
|
end
|
|
101
115
|
|
|
102
116
|
class SipIpAccessControlListList
|
|
117
|
+
include RawAttributes
|
|
103
118
|
include Pageable
|
|
104
119
|
attr_reader :ip_access_control_lists
|
|
105
120
|
def initialize(hash = {})
|
|
121
|
+
@raw_attributes = hash
|
|
106
122
|
assign_page_fields(hash)
|
|
107
123
|
@ip_access_control_lists = (hash['ip_access_control_lists'] || []).map { |h| SipIpAccessControlList.from_hash(h) }
|
|
108
124
|
end
|
|
@@ -111,6 +127,7 @@ module VoiceML
|
|
|
111
127
|
|
|
112
128
|
# SipIpAddress — `IP...`.
|
|
113
129
|
class SipIpAddress
|
|
130
|
+
include RawAttributes
|
|
114
131
|
ATTRIBUTES = %w[
|
|
115
132
|
sid account_sid ip_access_control_list_sid
|
|
116
133
|
friendly_name ip_address cidr_prefix_length
|
|
@@ -118,15 +135,18 @@ module VoiceML
|
|
|
118
135
|
].freeze
|
|
119
136
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
120
137
|
def initialize(attrs = {})
|
|
121
|
-
|
|
138
|
+
@raw_attributes = attrs
|
|
139
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
122
140
|
end
|
|
123
141
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
124
142
|
end
|
|
125
143
|
|
|
126
144
|
class SipIpAddressList
|
|
145
|
+
include RawAttributes
|
|
127
146
|
include Pageable
|
|
128
147
|
attr_reader :ip_addresses
|
|
129
148
|
def initialize(hash = {})
|
|
149
|
+
@raw_attributes = hash
|
|
130
150
|
assign_page_fields(hash)
|
|
131
151
|
@ip_addresses = (hash['ip_addresses'] || []).map { |h| SipIpAddress.from_hash(h) }
|
|
132
152
|
end
|
|
@@ -137,20 +157,24 @@ module VoiceML
|
|
|
137
157
|
# `sid` echoes the bound resource (CL... for credential mappings, AL... for IP-ACL);
|
|
138
158
|
# `domain_sid` records which domain the binding is attached to.
|
|
139
159
|
class SipDomainMapping
|
|
160
|
+
include RawAttributes
|
|
140
161
|
ATTRIBUTES = %w[
|
|
141
162
|
sid account_sid friendly_name domain_sid date_created date_updated uri
|
|
142
163
|
].freeze
|
|
143
164
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
144
165
|
def initialize(attrs = {})
|
|
145
|
-
|
|
166
|
+
@raw_attributes = attrs
|
|
167
|
+
ATTRIBUTES.each { |f| instance_variable_set("@#{f}", attrs.key?(f) ? attrs[f] : attrs[f.to_sym]) }
|
|
146
168
|
end
|
|
147
169
|
def self.from_hash(h); h.nil? ? nil : new(h); end
|
|
148
170
|
end
|
|
149
171
|
|
|
150
172
|
class SipCredentialListMappingList
|
|
173
|
+
include RawAttributes
|
|
151
174
|
include Pageable
|
|
152
175
|
attr_reader :credential_list_mappings
|
|
153
176
|
def initialize(hash = {})
|
|
177
|
+
@raw_attributes = hash
|
|
154
178
|
assign_page_fields(hash)
|
|
155
179
|
@credential_list_mappings = (hash['credential_list_mappings'] || []).map { |h| SipDomainMapping.from_hash(h) }
|
|
156
180
|
end
|
|
@@ -158,9 +182,11 @@ module VoiceML
|
|
|
158
182
|
end
|
|
159
183
|
|
|
160
184
|
class SipIpAccessControlListMappingList
|
|
185
|
+
include RawAttributes
|
|
161
186
|
include Pageable
|
|
162
187
|
attr_reader :ip_access_control_list_mappings
|
|
163
188
|
def initialize(hash = {})
|
|
189
|
+
@raw_attributes = hash
|
|
164
190
|
assign_page_fields(hash)
|
|
165
191
|
@ip_access_control_list_mappings = (hash['ip_access_control_list_mappings'] || []).map { |h| SipDomainMapping.from_hash(h) }
|
|
166
192
|
end
|
|
@@ -173,9 +199,11 @@ module VoiceML
|
|
|
173
199
|
# the same list shape is reused across CredentialList and IpAccessControlList
|
|
174
200
|
# auth mappings; the inner items decode as SipDomainMapping either way.
|
|
175
201
|
class SipAuthMappingList
|
|
202
|
+
include RawAttributes
|
|
176
203
|
include Pageable
|
|
177
204
|
attr_reader :contents
|
|
178
205
|
def initialize(hash = {})
|
|
206
|
+
@raw_attributes = hash
|
|
179
207
|
assign_page_fields(hash)
|
|
180
208
|
@contents = (hash['contents'] || []).map { |h| SipDomainMapping.from_hash(h) }
|
|
181
209
|
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'common'
|
|
4
|
+
|
|
5
|
+
module VoiceML
|
|
6
|
+
# One live SIP registration on a `SIP/Domains` ingress —
|
|
7
|
+
# `GET /SIP/Registrations`.
|
|
8
|
+
class SipRegistration
|
|
9
|
+
include RawAttributes
|
|
10
|
+
ATTRIBUTES = %w[
|
|
11
|
+
aor username domain domain_sid status caller_id user_agent
|
|
12
|
+
last_registered contacts active_call
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
16
|
+
|
|
17
|
+
def initialize(attrs = {})
|
|
18
|
+
@raw_attributes = attrs
|
|
19
|
+
ATTRIBUTES.each do |field|
|
|
20
|
+
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
21
|
+
instance_variable_set("@#{field}", value)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.from_hash(hash)
|
|
26
|
+
return nil if hash.nil?
|
|
27
|
+
|
|
28
|
+
new(hash)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Paginated `GET /SIP/Registrations` response.
|
|
33
|
+
class SipRegistrationList
|
|
34
|
+
include Pageable
|
|
35
|
+
include RawAttributes
|
|
36
|
+
|
|
37
|
+
attr_reader :registrations
|
|
38
|
+
|
|
39
|
+
def initialize(hash = {})
|
|
40
|
+
@raw_attributes = hash
|
|
41
|
+
assign_page_fields(hash)
|
|
42
|
+
@registrations = (hash['registrations'] || []).map { |r| SipRegistration.from_hash(r) }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.from_hash(hash)
|
|
46
|
+
new(hash || {})
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -4,15 +4,19 @@ require_relative 'common'
|
|
|
4
4
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# SIPREC-session resource (REST equivalent of `<Start><Siprec>`).
|
|
7
|
+
# Start (`POST /Calls/{Sid}/Siprec`) and stop (`POST /Calls/{Sid}/Siprec/{Sid}`)
|
|
8
|
+
# are the live operations; the list/fetch GETs were removed from the API.
|
|
7
9
|
class SiprecSession
|
|
10
|
+
include RawAttributes
|
|
8
11
|
ATTRIBUTES = %w[
|
|
9
|
-
sid account_sid call_sid name
|
|
12
|
+
sid account_sid call_sid name status api_version uri
|
|
10
13
|
date_created date_updated
|
|
11
14
|
].freeze
|
|
12
15
|
|
|
13
16
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
14
17
|
|
|
15
18
|
def initialize(attrs = {})
|
|
19
|
+
@raw_attributes = attrs
|
|
16
20
|
ATTRIBUTES.each do |field|
|
|
17
21
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
18
22
|
instance_variable_set("@#{field}", value)
|
|
@@ -25,20 +29,4 @@ module VoiceML
|
|
|
25
29
|
new(hash)
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
|
-
|
|
29
|
-
# Paginated `GET /Calls/{Sid}/Siprec` response.
|
|
30
|
-
class SiprecList
|
|
31
|
-
include Pageable
|
|
32
|
-
|
|
33
|
-
attr_reader :siprec
|
|
34
|
-
|
|
35
|
-
def initialize(hash = {})
|
|
36
|
-
assign_page_fields(hash)
|
|
37
|
-
@siprec = (hash['siprec'] || []).map { |s| SiprecSession.from_hash(s) }
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.from_hash(hash)
|
|
41
|
-
new(hash || {})
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
32
|
end
|
|
@@ -4,7 +4,10 @@ require_relative 'common'
|
|
|
4
4
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# Media-stream session (REST equivalent of `<Connect><Stream>` / `<Start><Stream>`).
|
|
7
|
+
# Start (`POST /Calls/{Sid}/Streams`) and stop (`POST /Calls/{Sid}/Streams/{Sid}`)
|
|
8
|
+
# are the live operations; the list/fetch GETs were removed from the API.
|
|
7
9
|
class Stream
|
|
10
|
+
include RawAttributes
|
|
8
11
|
ATTRIBUTES = %w[
|
|
9
12
|
sid account_sid call_sid name status api_version uri
|
|
10
13
|
date_created date_updated
|
|
@@ -13,6 +16,7 @@ module VoiceML
|
|
|
13
16
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
14
17
|
|
|
15
18
|
def initialize(attrs = {})
|
|
19
|
+
@raw_attributes = attrs
|
|
16
20
|
ATTRIBUTES.each do |field|
|
|
17
21
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
18
22
|
instance_variable_set("@#{field}", value)
|
|
@@ -25,20 +29,4 @@ module VoiceML
|
|
|
25
29
|
new(hash)
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
|
-
|
|
29
|
-
# Paginated `GET /Calls/{Sid}/Streams` response.
|
|
30
|
-
class StreamList
|
|
31
|
-
include Pageable
|
|
32
|
-
|
|
33
|
-
attr_reader :streams
|
|
34
|
-
|
|
35
|
-
def initialize(hash = {})
|
|
36
|
-
assign_page_fields(hash)
|
|
37
|
-
@streams = (hash['streams'] || []).map { |s| Stream.from_hash(s) }
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.from_hash(hash)
|
|
41
|
-
new(hash || {})
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
32
|
end
|
|
@@ -5,14 +5,16 @@ require_relative 'common'
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# Real-time per-call transcription (REST equivalent of `<Start><Transcription>`).
|
|
7
7
|
class CallTranscription
|
|
8
|
+
include RawAttributes
|
|
8
9
|
ATTRIBUTES = %w[
|
|
9
|
-
sid account_sid call_sid name
|
|
10
|
-
|
|
10
|
+
sid account_sid call_sid name status api_version uri
|
|
11
|
+
date_created date_updated
|
|
11
12
|
].freeze
|
|
12
13
|
|
|
13
14
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
14
15
|
|
|
15
16
|
def initialize(attrs = {})
|
|
17
|
+
@raw_attributes = attrs
|
|
16
18
|
ATTRIBUTES.each do |field|
|
|
17
19
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
18
20
|
instance_variable_set("@#{field}", value)
|
|
@@ -26,15 +28,44 @@ module VoiceML
|
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
#
|
|
31
|
+
# Stored transcription of a Recording — `GET /Recordings/{Sid}/Transcriptions`
|
|
32
|
+
# and the account-wide `GET /Transcriptions`.
|
|
33
|
+
class Transcription
|
|
34
|
+
include RawAttributes
|
|
35
|
+
ATTRIBUTES = %w[
|
|
36
|
+
sid account_sid status recording_sid duration transcription_text type
|
|
37
|
+
price price_unit api_version uri date_created date_updated
|
|
38
|
+
].freeze
|
|
39
|
+
|
|
40
|
+
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
41
|
+
|
|
42
|
+
def initialize(attrs = {})
|
|
43
|
+
@raw_attributes = attrs
|
|
44
|
+
ATTRIBUTES.each do |field|
|
|
45
|
+
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
46
|
+
instance_variable_set("@#{field}", value)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.from_hash(hash)
|
|
51
|
+
return nil if hash.nil?
|
|
52
|
+
|
|
53
|
+
new(hash)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Paginated Transcription response (`GET /Transcriptions`,
|
|
58
|
+
# `GET /Recordings/{RecordingSid}/Transcriptions`).
|
|
30
59
|
class TranscriptionList
|
|
31
60
|
include Pageable
|
|
61
|
+
include RawAttributes
|
|
32
62
|
|
|
33
63
|
attr_reader :transcriptions
|
|
34
64
|
|
|
35
65
|
def initialize(hash = {})
|
|
66
|
+
@raw_attributes = hash
|
|
36
67
|
assign_page_fields(hash)
|
|
37
|
-
@transcriptions = (hash['transcriptions'] || []).map { |t|
|
|
68
|
+
@transcriptions = (hash['transcriptions'] || []).map { |t| Transcription.from_hash(t) }
|
|
38
69
|
end
|
|
39
70
|
|
|
40
71
|
def self.from_hash(hash)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'common'
|
|
4
|
+
|
|
5
|
+
module VoiceML
|
|
6
|
+
# One usage bucket from `GET /Usage/Records[/{Window}]`.
|
|
7
|
+
class UsageRecord
|
|
8
|
+
include RawAttributes
|
|
9
|
+
ATTRIBUTES = %w[
|
|
10
|
+
account_sid api_version as_of category count count_unit description
|
|
11
|
+
end_date price price_unit start_date subresource_uris uri usage usage_unit
|
|
12
|
+
].freeze
|
|
13
|
+
|
|
14
|
+
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
15
|
+
|
|
16
|
+
def initialize(attrs = {})
|
|
17
|
+
@raw_attributes = attrs
|
|
18
|
+
ATTRIBUTES.each do |field|
|
|
19
|
+
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
20
|
+
instance_variable_set("@#{field}", value)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.from_hash(hash)
|
|
25
|
+
return nil if hash.nil?
|
|
26
|
+
|
|
27
|
+
new(hash)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Paginated `GET /Usage/Records...` response.
|
|
32
|
+
class UsageRecordList
|
|
33
|
+
include Pageable
|
|
34
|
+
include RawAttributes
|
|
35
|
+
|
|
36
|
+
attr_reader :usage_records
|
|
37
|
+
|
|
38
|
+
def initialize(hash = {})
|
|
39
|
+
@raw_attributes = hash
|
|
40
|
+
assign_page_fields(hash)
|
|
41
|
+
@usage_records = (hash['usage_records'] || []).map { |r| UsageRecord.from_hash(r) }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
new(hash || {})
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -9,6 +9,7 @@ module VoiceML
|
|
|
9
9
|
# the model exists to decode the response shape (KX-prefixed sid +
|
|
10
10
|
# account/call sids) for conformance and round-trip tooling.
|
|
11
11
|
class UserDefinedMessage
|
|
12
|
+
include RawAttributes
|
|
12
13
|
ATTRIBUTES = %w[
|
|
13
14
|
sid account_sid call_sid date_created
|
|
14
15
|
].freeze
|
|
@@ -16,6 +17,7 @@ module VoiceML
|
|
|
16
17
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
17
18
|
|
|
18
19
|
def initialize(attrs = {})
|
|
20
|
+
@raw_attributes = attrs
|
|
19
21
|
ATTRIBUTES.each do |field|
|
|
20
22
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
21
23
|
instance_variable_set("@#{field}", value)
|