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
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module VoiceML
|
|
4
4
|
# Twilio-compatible pagination envelope fields. Mix into list-response classes to expose
|
|
5
|
-
# `page`, `page_size`, `
|
|
6
|
-
# `uri
|
|
7
|
-
#
|
|
5
|
+
# `page`, `page_size`, `start`, `end`, `first_page_uri`, `next_page_uri`, `previous_page_uri`,
|
|
6
|
+
# `uri`. The list items themselves are declared on each concrete subclass (`calls`,
|
|
7
|
+
# `conferences`, etc).
|
|
8
8
|
module Pageable
|
|
9
9
|
PAGE_FIELDS = %w[
|
|
10
|
-
page page_size
|
|
10
|
+
page page_size start end
|
|
11
11
|
first_page_uri next_page_uri previous_page_uri uri
|
|
12
12
|
].freeze
|
|
13
13
|
|
|
@@ -22,6 +22,37 @@ module VoiceML
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
# Shared `meta` envelope for `/v1/*` list responses.
|
|
26
|
+
module V1Pageable
|
|
27
|
+
META_FIELDS = %w[first_page_url next_page_url previous_page_url url page page_size key].freeze
|
|
28
|
+
|
|
29
|
+
META_FIELDS.each { |f| attr_reader f.to_sym }
|
|
30
|
+
|
|
31
|
+
def assign_meta_fields(hash)
|
|
32
|
+
meta = hash['meta'] || {}
|
|
33
|
+
META_FIELDS.each { |f| instance_variable_set("@#{f}", meta[f]) }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Mixed into every response model: keeps the raw wire hash readable via
|
|
38
|
+
# `#to_h` / `#[]` so fields the SDK does not model yet (or newly added
|
|
39
|
+
# server-side) stay accessible without an SDK release. Unknown fields are
|
|
40
|
+
# ignored by the typed readers.
|
|
41
|
+
module RawAttributes
|
|
42
|
+
# The raw response hash this model was decoded from.
|
|
43
|
+
def to_h
|
|
44
|
+
@raw_attributes ||= {}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Read one field from the raw response hash, by either its wire (string)
|
|
48
|
+
# or symbol name. Returns `nil` for absent fields; `false` round-trips.
|
|
49
|
+
def [](key)
|
|
50
|
+
raw = to_h
|
|
51
|
+
string_key = key.to_s
|
|
52
|
+
raw.key?(string_key) ? raw[string_key] : raw[key.to_sym]
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
25
56
|
# Twilio-compatible error body. Surface only — the transport raises a VoiceML::ApiError
|
|
26
57
|
# subclass with this payload attached as `error.body`.
|
|
27
58
|
class ErrorBody
|
|
@@ -5,6 +5,7 @@ require_relative 'common'
|
|
|
5
5
|
module VoiceML
|
|
6
6
|
# A Twilio-compatible Conference resource.
|
|
7
7
|
class Conference
|
|
8
|
+
include RawAttributes
|
|
8
9
|
ATTRIBUTES = %w[
|
|
9
10
|
sid account_sid friendly_name status region api_version uri
|
|
10
11
|
date_created date_updated reason_conference_ended
|
|
@@ -14,6 +15,7 @@ module VoiceML
|
|
|
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)
|
|
@@ -29,11 +31,13 @@ module VoiceML
|
|
|
29
31
|
|
|
30
32
|
# Paginated `GET /Conferences` response.
|
|
31
33
|
class ConferenceList
|
|
34
|
+
include RawAttributes
|
|
32
35
|
include Pageable
|
|
33
36
|
|
|
34
37
|
attr_reader :conferences
|
|
35
38
|
|
|
36
39
|
def initialize(hash = {})
|
|
40
|
+
@raw_attributes = hash
|
|
37
41
|
assign_page_fields(hash)
|
|
38
42
|
@conferences = (hash['conferences'] || []).map { |c| Conference.from_hash(c) }
|
|
39
43
|
end
|
|
@@ -45,6 +49,7 @@ module VoiceML
|
|
|
45
49
|
|
|
46
50
|
# A participant in a live conference.
|
|
47
51
|
class Participant
|
|
52
|
+
include RawAttributes
|
|
48
53
|
ATTRIBUTES = %w[
|
|
49
54
|
call_sid conference_sid account_sid muted hold coaching call_sid_to_coach queue_time
|
|
50
55
|
start_conference_on_enter end_conference_on_exit status label
|
|
@@ -54,6 +59,7 @@ module VoiceML
|
|
|
54
59
|
attr_reader(*ATTRIBUTES.map(&:to_sym))
|
|
55
60
|
|
|
56
61
|
def initialize(attrs = {})
|
|
62
|
+
@raw_attributes = attrs
|
|
57
63
|
ATTRIBUTES.each do |field|
|
|
58
64
|
value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
|
|
59
65
|
instance_variable_set("@#{field}", value)
|
|
@@ -69,11 +75,13 @@ module VoiceML
|
|
|
69
75
|
|
|
70
76
|
# Paginated `GET /Conferences/{Sid}/Participants` response.
|
|
71
77
|
class ParticipantList
|
|
78
|
+
include RawAttributes
|
|
72
79
|
include Pageable
|
|
73
80
|
|
|
74
81
|
attr_reader :participants
|
|
75
82
|
|
|
76
83
|
def initialize(hash = {})
|
|
84
|
+
@raw_attributes = hash
|
|
77
85
|
assign_page_fields(hash)
|
|
78
86
|
@participants = (hash['participants'] || []).map { |p| Participant.from_hash(p) }
|
|
79
87
|
end
|