voicetel 2.2.10 → 2.2.14
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 +12 -11
- data/lib/voicetel/internal/transport.rb +4 -2
- data/lib/voicetel/models/account.rb +168 -0
- data/lib/voicetel/models/acl.rb +59 -0
- data/lib/voicetel/models/authentication.rb +52 -0
- data/lib/voicetel/models/base.rb +94 -0
- data/lib/voicetel/models/common.rb +20 -0
- data/lib/voicetel/models/e911.rb +72 -0
- data/lib/voicetel/models/gateways.rb +52 -0
- data/lib/voicetel/models/i_numbering.rb +140 -0
- data/lib/voicetel/models/lookups.rb +29 -0
- data/lib/voicetel/models/messaging.rb +143 -0
- data/lib/voicetel/models/numbers.rb +276 -0
- data/lib/voicetel/models/support.rb +191 -0
- data/lib/voicetel/models.rb +18 -0
- data/lib/voicetel/resources/account.rb +35 -12
- data/lib/voicetel/resources/acl.rb +14 -5
- data/lib/voicetel/resources/authentication.rb +14 -7
- data/lib/voicetel/resources/base.rb +6 -0
- data/lib/voicetel/resources/e911.rb +22 -6
- data/lib/voicetel/resources/gateways.rb +23 -6
- data/lib/voicetel/resources/i_numbering.rb +23 -8
- data/lib/voicetel/resources/lookups.rb +8 -2
- data/lib/voicetel/resources/messaging.rb +28 -8
- data/lib/voicetel/resources/numbers.rb +121 -28
- data/lib/voicetel/resources/support.rb +36 -10
- data/lib/voicetel/version.rb +3 -3
- data/lib/voicetel.rb +1 -0
- data/sig/voicetel.rbs +1252 -79
- data/voicetel.gemspec +3 -3
- metadata +18 -5
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module VoiceTel
|
|
6
|
+
module Models
|
|
7
|
+
# Note on SupportConversation#ticket_number: the OpenAPI spec types the
|
|
8
|
+
# wire field `number` as an integer — it's the human-readable ticket
|
|
9
|
+
# sequence (e.g. 1015), not a phone number. The model exposes it as
|
|
10
|
+
# ticket_number so callers don't confuse it with TNs.
|
|
11
|
+
|
|
12
|
+
# ------------------------------------------------------------- requests ---
|
|
13
|
+
# Body for POST /v2.2/support/tickets.
|
|
14
|
+
TicketCreateRequest = Data.define(:subject, :message, :email) do
|
|
15
|
+
include Request
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Body for PUT /v2.2/support/tickets/{id}. status is "active",
|
|
19
|
+
# "pending", "closed", or "spam".
|
|
20
|
+
TicketUpdateRequest = Data.define(:status) do
|
|
21
|
+
include Request
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Body for POST /v2.2/support/tickets/{id}/replies.
|
|
25
|
+
TicketReplyRequest = Data.define(:message) do
|
|
26
|
+
include Request
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# --------------------------------------------------------- shared subtypes ---
|
|
30
|
+
# Provenance of a ticket or thread.
|
|
31
|
+
TicketSource = Data.define(:via, :type) do
|
|
32
|
+
extend Base
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Action descriptor on a thread.
|
|
36
|
+
TicketAction = Data.define(:text, :type) do
|
|
37
|
+
extend Base
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# createdBy / assignee / assignedTo / closedByUser shape.
|
|
41
|
+
TicketActor = Data.define(
|
|
42
|
+
:id, :type, :email, :first_name, :last_name, :photo_url
|
|
43
|
+
) do
|
|
44
|
+
extend Base
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# One custom-field row on a conversation.
|
|
48
|
+
CustomFieldValue = Data.define(:id, :value, :text) do
|
|
49
|
+
extend Base
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# A single {id, value, type} entry under embedded emails/phones/
|
|
53
|
+
# socialProfiles.
|
|
54
|
+
CustomerContactEntry = Data.define(:id, :value, :type) do
|
|
55
|
+
extend Base
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# A single {id, value} entry under embedded.websites.
|
|
59
|
+
CustomerWebsiteEntry = Data.define(:id, :value) do
|
|
60
|
+
extend Base
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# embedded.address shape on a support customer.
|
|
64
|
+
CustomerAddress = Data.define(:street, :city, :state, :country, :zip) do
|
|
65
|
+
extend Base
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# embedded shape on SupportCustomer.
|
|
69
|
+
CustomerEmbedded = Data.define(
|
|
70
|
+
:address, :emails, :phones, :social_profiles, :websites
|
|
71
|
+
) do
|
|
72
|
+
extend Base
|
|
73
|
+
|
|
74
|
+
def self.nested
|
|
75
|
+
{ address: CustomerAddress, emails: CustomerContactEntry,
|
|
76
|
+
phones: CustomerContactEntry, social_profiles: CustomerContactEntry,
|
|
77
|
+
websites: CustomerWebsiteEntry }
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# -------------------------------------------------------------- attachments ---
|
|
82
|
+
# One file attached to a support thread.
|
|
83
|
+
SupportAttachment = Data.define(:id, :mime_type, :file_name, :file_url, :size) do
|
|
84
|
+
extend Base
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# embedded shape on SupportThread.
|
|
88
|
+
ThreadEmbedded = Data.define(:attachments) do
|
|
89
|
+
extend Base
|
|
90
|
+
|
|
91
|
+
def self.nested
|
|
92
|
+
{ attachments: SupportAttachment }
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# embedded shape on SupportConversation — typically wraps threads.
|
|
97
|
+
ConversationEmbedded = Data.define(:threads) do
|
|
98
|
+
extend Base
|
|
99
|
+
|
|
100
|
+
def self.nested
|
|
101
|
+
{ threads: SupportThread }
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# ----------------------------------------------------------------- entities ---
|
|
106
|
+
# End-user profile attached to a support ticket.
|
|
107
|
+
SupportCustomer = Data.define(
|
|
108
|
+
:id, :first_name, :last_name, :email, :company, :job_title, :photo_type, :photo_url,
|
|
109
|
+
:notes, :type, :created_at, :updated_at, :embedded
|
|
110
|
+
) do
|
|
111
|
+
extend Base
|
|
112
|
+
|
|
113
|
+
def self.nested
|
|
114
|
+
{ embedded: CustomerEmbedded }
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# One thread (message) within a ticket conversation. type is "customer"
|
|
119
|
+
# (from the user), "message" (staff reply), or "note" (internal note).
|
|
120
|
+
SupportThread = Data.define(
|
|
121
|
+
:id, :status, :state, :type, :body, :rating, :rating_comment, :opened_at, :created_at,
|
|
122
|
+
:source, :action, :created_by, :assigned_to, :customer, :to, :cc, :bcc, :embedded
|
|
123
|
+
) do
|
|
124
|
+
extend Base
|
|
125
|
+
|
|
126
|
+
def self.nested
|
|
127
|
+
{ source: TicketSource, action: TicketAction, created_by: TicketActor,
|
|
128
|
+
assigned_to: TicketActor, customer: SupportCustomer, embedded: ThreadEmbedded }
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# A support ticket. Returned by GET /v2.2/support/tickets/{id} and as
|
|
133
|
+
# the items of the list endpoint.
|
|
134
|
+
SupportConversation = Data.define(
|
|
135
|
+
:id, :ticket_number, :status, :state, :subject, :preview, :type, :mailbox_id,
|
|
136
|
+
:folder_id, :threads_count, :closed_by, :closed_at, :created_at, :updated_at,
|
|
137
|
+
:user_updated_at, :customer_waiting_since, :source, :created_by, :assignee,
|
|
138
|
+
:closed_by_user, :customer, :cc, :bcc, :custom_fields, :embedded
|
|
139
|
+
) do
|
|
140
|
+
extend Base
|
|
141
|
+
|
|
142
|
+
def self.nested
|
|
143
|
+
{ source: TicketSource, created_by: TicketActor, assignee: TicketActor,
|
|
144
|
+
closed_by_user: TicketActor, customer: SupportCustomer,
|
|
145
|
+
custom_fields: CustomFieldValue, embedded: ConversationEmbedded }
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def self.wire_keys
|
|
149
|
+
{ ticket_number: "number" }
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# ------------------------------------------------------ response data ---
|
|
154
|
+
# Data payload from GET /v2.2/support/tickets/{id}.
|
|
155
|
+
TicketData = Data.define(:ticket) do
|
|
156
|
+
extend Base
|
|
157
|
+
|
|
158
|
+
def self.nested
|
|
159
|
+
{ ticket: SupportConversation }
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Data payload from GET /v2.2/support/tickets.
|
|
164
|
+
TicketsListData = Data.define(:tickets) do
|
|
165
|
+
extend Base
|
|
166
|
+
|
|
167
|
+
def self.nested
|
|
168
|
+
{ tickets: SupportConversation }
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Data payload from GET /v2.2/support/tickets/{id}/messages.
|
|
173
|
+
TicketThreadsData = Data.define(:messages) do
|
|
174
|
+
extend Base
|
|
175
|
+
|
|
176
|
+
def self.nested
|
|
177
|
+
{ messages: SupportThread }
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Data payload from POST /v2.2/support/tickets/{id}/replies.
|
|
182
|
+
TicketReplyData = Data.define(:message) do
|
|
183
|
+
extend Base
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Data payload from PUT /v2.2/support/tickets/{id}.
|
|
187
|
+
TicketUpdateData = Data.define(:id, :status) do
|
|
188
|
+
extend Base
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Hub for the model layer — mirrors the spec's schemas one file per
|
|
4
|
+
# resource. Response models are built by the resource layer via .build;
|
|
5
|
+
# request models are accepted wherever a plain Hash body is.
|
|
6
|
+
|
|
7
|
+
require_relative "models/base"
|
|
8
|
+
require_relative "models/common"
|
|
9
|
+
require_relative "models/account"
|
|
10
|
+
require_relative "models/acl"
|
|
11
|
+
require_relative "models/authentication"
|
|
12
|
+
require_relative "models/e911"
|
|
13
|
+
require_relative "models/gateways"
|
|
14
|
+
require_relative "models/i_numbering"
|
|
15
|
+
require_relative "models/lookups"
|
|
16
|
+
require_relative "models/messaging"
|
|
17
|
+
require_relative "models/numbers"
|
|
18
|
+
require_relative "models/support"
|
|
@@ -9,55 +9,78 @@ module VoiceTel
|
|
|
9
9
|
# Rate-limited endpoints (6 req/hour/IP, shared with Client#login):
|
|
10
10
|
# `cdr`, `recurring_charges`, `payments`, `registration`, and `info`.
|
|
11
11
|
class Account < Base
|
|
12
|
-
# GET /v2.2/account —
|
|
12
|
+
# GET /v2.2/account — the authenticated account profile.
|
|
13
|
+
#
|
|
14
|
+
# @return [Models::AccountData]
|
|
13
15
|
def get
|
|
14
|
-
@transport.request(:get, "/v2.2/account")
|
|
16
|
+
Models::AccountData.build(@transport.request(:get, "/v2.2/account"))
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
# PUT /v2.2/account — partial-update account settings.
|
|
20
|
+
#
|
|
21
|
+
# @return [Models::AccountPutData]
|
|
18
22
|
def update(body)
|
|
19
|
-
@transport.request(:put, "/v2.2/account", body: body)
|
|
23
|
+
Models::AccountPutData.build(@transport.request(:put, "/v2.2/account", body: payload(body)))
|
|
20
24
|
end
|
|
21
25
|
|
|
22
26
|
# POST /v2.2/account — create a sub-account (admin-only).
|
|
27
|
+
#
|
|
28
|
+
# @return [Models::AccountAddData]
|
|
23
29
|
def add(body)
|
|
24
|
-
@transport.request(:post, "/v2.2/account", body: body)
|
|
30
|
+
Models::AccountAddData.build(@transport.request(:post, "/v2.2/account", body: payload(body)))
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
# POST /v2.2/accounts — public sign-up flow.
|
|
34
|
+
#
|
|
35
|
+
# @return [Models::AccountSignupData]
|
|
28
36
|
def signup(body)
|
|
29
|
-
@transport.request(:post, "/v2.2/accounts", body: body)
|
|
37
|
+
Models::AccountSignupData.build(@transport.request(:post, "/v2.2/accounts", body: payload(body)))
|
|
30
38
|
end
|
|
31
39
|
|
|
32
40
|
# GET /v2.2/account/cdr — call detail records. Rate-limited.
|
|
41
|
+
#
|
|
42
|
+
# @return [Models::AccountCdrData]
|
|
33
43
|
def cdr(start: nil, end_at: nil)
|
|
34
44
|
q = compact_query("start" => start, "end" => end_at)
|
|
35
|
-
@transport.request(:get, "/v2.2/account/cdr", query: q)
|
|
45
|
+
Models::AccountCdrData.build(@transport.request(:get, "/v2.2/account/cdr", query: q))
|
|
36
46
|
end
|
|
37
47
|
|
|
38
48
|
# GET /v2.2/account/credits — credit history.
|
|
49
|
+
#
|
|
50
|
+
# @return [Models::AccountCreditsData]
|
|
39
51
|
def credits
|
|
40
|
-
@transport.request(:get, "/v2.2/account/credits")
|
|
52
|
+
Models::AccountCreditsData.build(@transport.request(:get, "/v2.2/account/credits"))
|
|
41
53
|
end
|
|
42
54
|
|
|
43
|
-
# GET /v2.2/account/recurring-charges — active monthly recurring
|
|
55
|
+
# GET /v2.2/account/recurring-charges — active monthly recurring
|
|
56
|
+
# charges. Rate-limited.
|
|
57
|
+
#
|
|
58
|
+
# @return [Models::AccountMrcData]
|
|
44
59
|
def recurring_charges
|
|
45
|
-
@transport.request(:get, "/v2.2/account/recurring-charges")
|
|
60
|
+
Models::AccountMrcData.build(@transport.request(:get, "/v2.2/account/recurring-charges"))
|
|
46
61
|
end
|
|
47
62
|
|
|
48
63
|
# GET /v2.2/account/payments — payment history. Rate-limited.
|
|
64
|
+
#
|
|
65
|
+
# @return [Models::AccountPaymentsData]
|
|
49
66
|
def payments
|
|
50
|
-
@transport.request(:get, "/v2.2/account/payments")
|
|
67
|
+
Models::AccountPaymentsData.build(@transport.request(:get, "/v2.2/account/payments"))
|
|
51
68
|
end
|
|
52
69
|
|
|
53
70
|
# GET /v2.2/account/registration — current SIP registration. Rate-limited.
|
|
71
|
+
#
|
|
72
|
+
# @return [Models::AccountRegistrationData]
|
|
54
73
|
def registration
|
|
55
|
-
@transport.request(:get, "/v2.2/account/registration")
|
|
74
|
+
Models::AccountRegistrationData.build(@transport.request(:get, "/v2.2/account/registration"))
|
|
56
75
|
end
|
|
57
76
|
|
|
58
77
|
# POST /v2.2/account/recovery — start password recovery. No auth required.
|
|
78
|
+
#
|
|
79
|
+
# @return [Models::AccountRecoverData]
|
|
59
80
|
def recover(body)
|
|
60
|
-
|
|
81
|
+
Models::AccountRecoverData.build(
|
|
82
|
+
@transport.request(:post, "/v2.2/account/recovery", body: payload(body), require_auth: false)
|
|
83
|
+
)
|
|
61
84
|
end
|
|
62
85
|
end
|
|
63
86
|
end
|
|
@@ -8,19 +8,28 @@ module VoiceTel
|
|
|
8
8
|
#
|
|
9
9
|
# The DELETE /v2.2/acl endpoint is unusual: it returns 200 with a body
|
|
10
10
|
# (not 204). 409 conflicts include partial success/failure detail in the
|
|
11
|
-
# body — surfaced through ApiError#body so callers can inspect it
|
|
11
|
+
# body — surfaced through ApiError#body so callers can inspect it (or
|
|
12
|
+
# build a Models::AclConflictData from it).
|
|
12
13
|
class Acl < Base
|
|
14
|
+
# GET /v2.2/acl — the current allowlist.
|
|
15
|
+
#
|
|
16
|
+
# @return [Models::AclListData]
|
|
13
17
|
def list
|
|
14
|
-
@transport.request(:get, "/v2.2/acl")
|
|
18
|
+
Models::AclListData.build(@transport.request(:get, "/v2.2/acl"))
|
|
15
19
|
end
|
|
16
20
|
|
|
17
|
-
# body example: { acl: [{ cidr: "1.2.3.0/24" }] }
|
|
21
|
+
# POST /v2.2/acl — body example: { acl: [{ cidr: "1.2.3.0/24" }] }
|
|
22
|
+
#
|
|
23
|
+
# @return [Models::AclAddData]
|
|
18
24
|
def add(body)
|
|
19
|
-
@transport.request(:post, "/v2.2/acl", body: body)
|
|
25
|
+
Models::AclAddData.build(@transport.request(:post, "/v2.2/acl", body: payload(body)))
|
|
20
26
|
end
|
|
21
27
|
|
|
28
|
+
# DELETE /v2.2/acl — returns 200 with a body, not 204.
|
|
29
|
+
#
|
|
30
|
+
# @return [Models::AclRemoveData]
|
|
22
31
|
def remove(body)
|
|
23
|
-
@transport.request(:delete, "/v2.2/acl", body: body)
|
|
32
|
+
Models::AclRemoveData.build(@transport.request(:delete, "/v2.2/acl", body: payload(body)))
|
|
24
33
|
end
|
|
25
34
|
end
|
|
26
35
|
end
|
|
@@ -6,19 +6,26 @@ module VoiceTel
|
|
|
6
6
|
module Resources
|
|
7
7
|
# AuthenticationService — SIP/HTTP authentication settings (mode + password).
|
|
8
8
|
#
|
|
9
|
-
# auth_type values: 0
|
|
9
|
+
# auth_type values: 0=Digest, 1=Lax (Digest | IP), 2=IP, 3=Strict
|
|
10
|
+
# (Digest + IP).
|
|
10
11
|
class Authentication < Base
|
|
11
|
-
AUTH_TYPE_DIGEST
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
AUTH_TYPE_DIGEST = 0
|
|
13
|
+
AUTH_TYPE_LAX = 1
|
|
14
|
+
AUTH_TYPE_IP = 2
|
|
15
|
+
AUTH_TYPE_STRICT = 3
|
|
15
16
|
|
|
17
|
+
# GET /v2.2/auth — the active auth mode.
|
|
18
|
+
#
|
|
19
|
+
# @return [Models::AuthGetData]
|
|
16
20
|
def get
|
|
17
|
-
@transport.request(:get, "/v2.2/auth")
|
|
21
|
+
Models::AuthGetData.build(@transport.request(:get, "/v2.2/auth"))
|
|
18
22
|
end
|
|
19
23
|
|
|
24
|
+
# PUT /v2.2/auth — update the auth mode and/or password.
|
|
25
|
+
#
|
|
26
|
+
# @return [Models::AuthPutData]
|
|
20
27
|
def update(body)
|
|
21
|
-
@transport.request(:put, "/v2.2/auth", body: body)
|
|
28
|
+
Models::AuthPutData.build(@transport.request(:put, "/v2.2/auth", body: payload(body)))
|
|
22
29
|
end
|
|
23
30
|
end
|
|
24
31
|
end
|
|
@@ -16,6 +16,12 @@ module VoiceTel
|
|
|
16
16
|
def compact_query(hash)
|
|
17
17
|
hash.reject { |_, v| v.nil? || v == "" }
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
# Request bodies accept either a plain Hash (snake_case keys) or a
|
|
21
|
+
# Models request object; the transport only speaks Hashes.
|
|
22
|
+
def payload(body)
|
|
23
|
+
body.respond_to?(:to_payload) ? body.to_payload : body
|
|
24
|
+
end
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
end
|
|
@@ -9,27 +9,43 @@ module VoiceTel
|
|
|
9
9
|
# Note: request bodies take a 10-digit TN in `dn`; responses return the
|
|
10
10
|
# 11-digit E.164 US form (leading 1).
|
|
11
11
|
class E911 < Base
|
|
12
|
+
# GET /v2.2/e911 — every e911 record on the account.
|
|
13
|
+
#
|
|
14
|
+
# @return [Models::E911AllData]
|
|
12
15
|
def list
|
|
13
|
-
@transport.request(:get, "/v2.2/e911")
|
|
16
|
+
Models::E911AllData.build(@transport.request(:get, "/v2.2/e911"))
|
|
14
17
|
end
|
|
15
18
|
|
|
19
|
+
# POST /v2.2/e911 — validate and provision in one call.
|
|
20
|
+
#
|
|
21
|
+
# @return [Models::E911RecordData]
|
|
16
22
|
def create(body)
|
|
17
|
-
@transport.request(:post, "/v2.2/e911", body: body)
|
|
23
|
+
Models::E911RecordData.build(@transport.request(:post, "/v2.2/e911", body: payload(body)))
|
|
18
24
|
end
|
|
19
25
|
|
|
26
|
+
# POST /v2.2/e911/validations — validate an address without
|
|
27
|
+
# provisioning it.
|
|
28
|
+
#
|
|
29
|
+
# @return [Models::E911ValidateData]
|
|
20
30
|
def validate(body)
|
|
21
|
-
@transport.request(:post, "/v2.2/e911/validations", body: body)
|
|
31
|
+
Models::E911ValidateData.build(@transport.request(:post, "/v2.2/e911/validations", body: payload(body)))
|
|
22
32
|
end
|
|
23
33
|
|
|
34
|
+
# GET /v2.2/e911/{dn} — one record.
|
|
35
|
+
#
|
|
36
|
+
# @return [Models::E911RecordData]
|
|
24
37
|
def get(dn)
|
|
25
|
-
@transport.request(:get, "/v2.2/e911/#{dn}")
|
|
38
|
+
Models::E911RecordData.build(@transport.request(:get, "/v2.2/e911/#{dn}"))
|
|
26
39
|
end
|
|
27
40
|
|
|
41
|
+
# PUT /v2.2/e911/{dn} — provision with a previously-validated address.
|
|
42
|
+
#
|
|
43
|
+
# @return [Models::E911RecordData]
|
|
28
44
|
def provision(dn, body)
|
|
29
|
-
@transport.request(:put, "/v2.2/e911/#{dn}", body: body)
|
|
45
|
+
Models::E911RecordData.build(@transport.request(:put, "/v2.2/e911/#{dn}", body: payload(body)))
|
|
30
46
|
end
|
|
31
47
|
|
|
32
|
-
# Returns nil on 204 No Content.
|
|
48
|
+
# DELETE /v2.2/e911/{dn}. Returns nil on 204 No Content.
|
|
33
49
|
def remove(dn)
|
|
34
50
|
@transport.request(:delete, "/v2.2/e911/#{dn}")
|
|
35
51
|
end
|
|
@@ -5,30 +5,47 @@ require_relative "base"
|
|
|
5
5
|
module VoiceTel
|
|
6
6
|
module Resources
|
|
7
7
|
# GatewaysService — outbound termination gateways on the account.
|
|
8
|
+
#
|
|
9
|
+
# System route types: USER, T30, VOICEML, DID, T38, RTC_BRIDGE, SDN.
|
|
8
10
|
class Gateways < Base
|
|
11
|
+
# GET /v2.2/gateways — every gateway on the account.
|
|
12
|
+
#
|
|
13
|
+
# @return [Models::GatewaysListData]
|
|
9
14
|
def list
|
|
10
|
-
@transport.request(:get, "/v2.2/gateways")
|
|
15
|
+
Models::GatewaysListData.build(@transport.request(:get, "/v2.2/gateways"))
|
|
11
16
|
end
|
|
12
17
|
|
|
18
|
+
# POST /v2.2/gateways — add a gateway.
|
|
19
|
+
#
|
|
20
|
+
# @return [Models::GatewayEntry]
|
|
13
21
|
def add(body)
|
|
14
|
-
@transport.request(:post, "/v2.2/gateways", body: body)
|
|
22
|
+
Models::GatewayEntry.build(@transport.request(:post, "/v2.2/gateways", body: payload(body)))
|
|
15
23
|
end
|
|
16
24
|
|
|
25
|
+
# GET /v2.2/gateways/{id} — one gateway.
|
|
26
|
+
#
|
|
27
|
+
# @return [Models::GatewayEntry]
|
|
17
28
|
def get(id)
|
|
18
|
-
@transport.request(:get, "/v2.2/gateways/#{id}")
|
|
29
|
+
Models::GatewayEntry.build(@transport.request(:get, "/v2.2/gateways/#{id}"))
|
|
19
30
|
end
|
|
20
31
|
|
|
32
|
+
# PUT /v2.2/gateways/{id} — update a gateway.
|
|
33
|
+
#
|
|
34
|
+
# @return [Models::GatewayEntry]
|
|
21
35
|
def update(id, body)
|
|
22
|
-
@transport.request(:put, "/v2.2/gateways/#{id}", body: body)
|
|
36
|
+
Models::GatewayEntry.build(@transport.request(:put, "/v2.2/gateways/#{id}", body: payload(body)))
|
|
23
37
|
end
|
|
24
38
|
|
|
25
|
-
# Returns nil on 204 No Content.
|
|
39
|
+
# DELETE /v2.2/gateways/{id}. Returns nil on 204 No Content.
|
|
26
40
|
def remove(id)
|
|
27
41
|
@transport.request(:delete, "/v2.2/gateways/#{id}")
|
|
28
42
|
end
|
|
29
43
|
|
|
44
|
+
# GET /v2.2/gateways/{id}/numbers — numbers bound to a gateway.
|
|
45
|
+
#
|
|
46
|
+
# @return [Models::GatewayNumbersData]
|
|
30
47
|
def numbers(id)
|
|
31
|
-
@transport.request(:get, "/v2.2/gateways/#{id}/numbers")
|
|
48
|
+
Models::GatewayNumbersData.build(@transport.request(:get, "/v2.2/gateways/#{id}/numbers"))
|
|
32
49
|
end
|
|
33
50
|
end
|
|
34
51
|
end
|
|
@@ -10,43 +10,58 @@ module VoiceTel
|
|
|
10
10
|
# `rate_center_tier` alongside `number`, `portable`, `losing_carrier`, `reason`.
|
|
11
11
|
class INumbering < Base
|
|
12
12
|
# GET /v2.2/inventory — search available TNs.
|
|
13
|
+
#
|
|
14
|
+
# @return [Models::InventorySearchData]
|
|
13
15
|
def search_inventory(npa: nil, nxx: nil, state: nil, ratecenter: nil, contains: nil, endswith: nil, limit: nil)
|
|
14
16
|
q = compact_query(
|
|
15
17
|
"npa" => npa, "nxx" => nxx, "state" => state, "ratecenter" => ratecenter,
|
|
16
18
|
"contains" => contains, "endswith" => endswith, "limit" => limit
|
|
17
19
|
)
|
|
18
|
-
@transport.request(:get, "/v2.2/inventory", query: q)
|
|
20
|
+
Models::InventorySearchData.build(@transport.request(:get, "/v2.2/inventory", query: q))
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
# GET /v2.2/inventory/coverage — aggregated availability buckets.
|
|
24
|
+
#
|
|
25
|
+
# @return [Models::InventoryCoverageData]
|
|
22
26
|
def coverage(state: nil, ratecenter: nil)
|
|
23
27
|
q = compact_query("state" => state, "ratecenter" => ratecenter)
|
|
24
|
-
@transport.request(:get, "/v2.2/inventory/coverage", query: q)
|
|
28
|
+
Models::InventoryCoverageData.build(@transport.request(:get, "/v2.2/inventory/coverage", query: q))
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
# POST /v2.2/orders — purchase new TNs.
|
|
32
|
+
#
|
|
33
|
+
# @return [Models::OrderCreateData]
|
|
28
34
|
def order(body)
|
|
29
|
-
@transport.request(:post, "/v2.2/orders", body: body)
|
|
35
|
+
Models::OrderCreateData.build(@transport.request(:post, "/v2.2/orders", body: payload(body)))
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
# GET /v2.2/ports — list every port-in record.
|
|
39
|
+
#
|
|
40
|
+
# @return [Models::PortListData]
|
|
33
41
|
def ports
|
|
34
|
-
@transport.request(:get, "/v2.2/ports")
|
|
42
|
+
Models::PortListData.build(@transport.request(:get, "/v2.2/ports"))
|
|
35
43
|
end
|
|
36
44
|
|
|
37
45
|
# GET /v2.2/ports/{id} — detail for one port-in.
|
|
46
|
+
#
|
|
47
|
+
# @return [Models::PortDetailData]
|
|
38
48
|
def port(id)
|
|
39
|
-
@transport.request(:get, "/v2.2/ports/#{id}")
|
|
49
|
+
Models::PortDetailData.build(@transport.request(:get, "/v2.2/ports/#{id}"))
|
|
40
50
|
end
|
|
41
51
|
|
|
42
52
|
# POST /v2.2/ports — submit a port-in.
|
|
53
|
+
#
|
|
54
|
+
# @return [Models::PortSubmitData]
|
|
43
55
|
def submit_port(body)
|
|
44
|
-
@transport.request(:post, "/v2.2/ports", body: body)
|
|
56
|
+
Models::PortSubmitData.build(@transport.request(:post, "/v2.2/ports", body: payload(body)))
|
|
45
57
|
end
|
|
46
58
|
|
|
47
|
-
# GET /v2.2/ports/availability/{number} — check whether a TN can be
|
|
59
|
+
# GET /v2.2/ports/availability/{number} — check whether a TN can be
|
|
60
|
+
# ported in.
|
|
61
|
+
#
|
|
62
|
+
# @return [Models::PortAvailabilityData]
|
|
48
63
|
def port_availability(number)
|
|
49
|
-
@transport.request(:get, "/v2.2/ports/availability/#{number}")
|
|
64
|
+
Models::PortAvailabilityData.build(@transport.request(:get, "/v2.2/ports/availability/#{number}"))
|
|
50
65
|
end
|
|
51
66
|
end
|
|
52
67
|
end
|
|
@@ -8,12 +8,18 @@ module VoiceTel
|
|
|
8
8
|
#
|
|
9
9
|
# Each call costs money; meter accordingly.
|
|
10
10
|
class Lookups < Base
|
|
11
|
+
# GET /v2.2/cnam/{number} — CNAM dip.
|
|
12
|
+
#
|
|
13
|
+
# @return [Models::CnamData]
|
|
11
14
|
def cnam(number)
|
|
12
|
-
@transport.request(:get, "/v2.2/cnam/#{number}")
|
|
15
|
+
Models::CnamData.build(@transport.request(:get, "/v2.2/cnam/#{number}"))
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
# GET /v2.2/lrn/{number}/{ani} — LRN dip.
|
|
19
|
+
#
|
|
20
|
+
# @return [Models::LrnLookupData]
|
|
15
21
|
def lrn(number, ani)
|
|
16
|
-
@transport.request(:get, "/v2.2/lrn/#{number}/#{ani}")
|
|
22
|
+
Models::LrnLookupData.build(@transport.request(:get, "/v2.2/lrn/#{number}/#{ani}"))
|
|
17
23
|
end
|
|
18
24
|
end
|
|
19
25
|
end
|
|
@@ -11,6 +11,8 @@ module VoiceTel
|
|
|
11
11
|
# transport will translate them when serializing.
|
|
12
12
|
class Messaging < Base
|
|
13
13
|
# GET /v2.2/messages — fetch message history.
|
|
14
|
+
#
|
|
15
|
+
# @return [Models::MessageHistoryData]
|
|
14
16
|
def history(number: nil, start: nil, end_at: nil, type: nil)
|
|
15
17
|
q = compact_query(
|
|
16
18
|
"number" => number,
|
|
@@ -18,36 +20,54 @@ module VoiceTel
|
|
|
18
20
|
"end" => end_at,
|
|
19
21
|
"type" => type
|
|
20
22
|
)
|
|
21
|
-
@transport.request(:get, "/v2.2/messages", query: q)
|
|
23
|
+
Models::MessageHistoryData.build(@transport.request(:get, "/v2.2/messages", query: q))
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
# POST /v2.2/messages — send an SMS or MMS.
|
|
27
|
+
#
|
|
28
|
+
# @return [Models::MessageSendData]
|
|
25
29
|
def send_message(body)
|
|
26
|
-
@transport.request(:post, "/v2.2/messages", body: body)
|
|
30
|
+
Models::MessageSendData.build(@transport.request(:post, "/v2.2/messages", body: payload(body)))
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
# POST /v2.2/messaging/brands — register a 10DLC brand.
|
|
34
|
+
#
|
|
35
|
+
# @return [Models::MessagingBrandCreateData]
|
|
30
36
|
def create_brand(body)
|
|
31
|
-
|
|
37
|
+
Models::MessagingBrandCreateData.build(
|
|
38
|
+
@transport.request(:post, "/v2.2/messaging/brands", body: payload(body))
|
|
39
|
+
)
|
|
32
40
|
end
|
|
33
41
|
|
|
34
|
-
# GET /v2.2/messaging/campaigns — current 10DLC campaign statuses
|
|
42
|
+
# GET /v2.2/messaging/campaigns — current 10DLC campaign statuses,
|
|
43
|
+
# including carrier (DCA) review progress per campaign.
|
|
44
|
+
#
|
|
45
|
+
# @return [Models::MessagingCampaignStatusData]
|
|
35
46
|
def campaign_status
|
|
36
|
-
@transport.request(:get, "/v2.2/messaging/campaigns")
|
|
47
|
+
Models::MessagingCampaignStatusData.build(@transport.request(:get, "/v2.2/messaging/campaigns"))
|
|
37
48
|
end
|
|
38
49
|
|
|
39
|
-
# POST /v2.2/messaging/campaigns — register a 10DLC campaign.
|
|
50
|
+
# POST /v2.2/messaging/campaigns — register a 10DLC campaign. The body
|
|
51
|
+
# is passed through to the campaign registration service;
|
|
52
|
+
# campaignClassName (from the campaign registry) and
|
|
53
|
+
# campaignStartDate (today) are auto-populated if omitted.
|
|
54
|
+
#
|
|
55
|
+
# @return [Models::MessagingCampaignCreateData]
|
|
40
56
|
def create_campaign(body)
|
|
41
|
-
|
|
57
|
+
Models::MessagingCampaignCreateData.build(
|
|
58
|
+
@transport.request(:post, "/v2.2/messaging/campaigns", body: payload(body))
|
|
59
|
+
)
|
|
42
60
|
end
|
|
43
61
|
|
|
44
62
|
# GET /v2.2/numbers/messaging — messaging state for many numbers.
|
|
45
63
|
# Pass an empty array (or omit) for "all numbers on the account".
|
|
64
|
+
#
|
|
65
|
+
# @return [Models::NumbersMessagingListData]
|
|
46
66
|
def numbers_state(numbers: nil)
|
|
47
67
|
q = compact_query(
|
|
48
68
|
"numbers" => (numbers && !numbers.empty? ? Array(numbers).join(",") : nil)
|
|
49
69
|
)
|
|
50
|
-
@transport.request(:get, "/v2.2/numbers/messaging", query: q)
|
|
70
|
+
Models::NumbersMessagingListData.build(@transport.request(:get, "/v2.2/numbers/messaging", query: q))
|
|
51
71
|
end
|
|
52
72
|
end
|
|
53
73
|
end
|