telnyx 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile +1 -0
- data/README.md +41 -3
- data/VERSION +1 -1
- data/bin/telnyx-console +2 -1
- data/lib/telnyx.rb +17 -2
- data/lib/telnyx/address.rb +12 -0
- data/lib/telnyx/api_operations/list.rb +1 -1
- data/lib/telnyx/api_operations/nested_resource.rb +2 -2
- data/lib/telnyx/api_resource.rb +1 -1
- data/lib/telnyx/billing_group.rb +12 -0
- data/lib/telnyx/call_control_application.rb +12 -0
- data/lib/telnyx/{conferences.rb → conference.rb} +2 -1
- data/lib/telnyx/connection.rb +9 -0
- data/lib/telnyx/credential_connection.rb +12 -0
- data/lib/telnyx/fqdn.rb +12 -0
- data/lib/telnyx/fqdn_connection.rb +12 -0
- data/lib/telnyx/ip.rb +12 -0
- data/lib/telnyx/ip_connection.rb +12 -0
- data/lib/telnyx/list_object.rb +30 -44
- data/lib/telnyx/number_order_document.rb +11 -0
- data/lib/telnyx/outbound_voice_profile.rb +12 -0
- data/lib/telnyx/phone_number.rb +11 -0
- data/lib/telnyx/phone_number_regulatory_requirement.rb +9 -0
- data/lib/telnyx/portout.rb +12 -0
- data/lib/telnyx/regulatory_requirement.rb +9 -0
- data/lib/telnyx/telnyx_client.rb +1 -1
- data/lib/telnyx/util.rb +31 -13
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx/wireless_detail_records_report.rb +12 -0
- data/test/telnyx/address_test.rb +67 -0
- data/test/telnyx/alphanumeric_sender_id_test.rb +4 -0
- data/test/telnyx/api_resource_test.rb +14 -5
- data/test/telnyx/billing_group_test.rb +40 -0
- data/test/telnyx/call_control_application_test.rb +42 -0
- data/test/telnyx/{conferences_test.rb → conference_test.rb} +5 -5
- data/test/telnyx/connection_test.rb +28 -0
- data/test/telnyx/credential_connection_test.rb +40 -0
- data/test/telnyx/errors_test.rb +4 -4
- data/test/telnyx/fqdn_connection_test.rb +40 -0
- data/test/telnyx/fqdn_test.rb +40 -0
- data/test/telnyx/ip_connection_test.rb +40 -0
- data/test/telnyx/ip_test.rb +40 -0
- data/test/telnyx/list_object_test.rb +48 -90
- data/test/telnyx/messaging_profile_test.rb +15 -4
- data/test/telnyx/number_order_document_test.rb +35 -0
- data/test/telnyx/outbound_voice_profile_test.rb +67 -0
- data/test/telnyx/phone_number_regulatory_requirement_test.rb +14 -0
- data/test/telnyx/phone_number_test.rb +38 -0
- data/test/telnyx/public_key_test.rb +1 -0
- data/test/telnyx/regulatory_requirement_test.rb +21 -0
- data/test/telnyx/sim_card_test.rb +2 -14
- data/test/telnyx/telnyx_client_test.rb +1 -1
- data/test/telnyx/wireless_detail_records_report_test.rb +57 -0
- data/test/test_helper.rb +1 -1
- metadata +50 -6
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../test_helper"
|
5
|
+
|
6
|
+
module Telnyx
|
7
|
+
class PhoneNumberRegulatoryRequirementTest < Test::Unit::TestCase
|
8
|
+
should "be listable" do
|
9
|
+
phone_number_reg_req = PhoneNumberRegulatoryRequirement.list
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/phone_number_regulatory_requirements"
|
11
|
+
assert_kind_of PhoneNumberRegulatoryRequirement, phone_number_reg_req.first
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -84,6 +84,44 @@ module Telnyx
|
|
84
84
|
phone_number.update_messaging(messaging_profile_id: "12345", messaging_product: "P2P")
|
85
85
|
assert_requested command_stub
|
86
86
|
end
|
87
|
+
|
88
|
+
should "list inbound channels" do
|
89
|
+
stub_request(:get, "#{Telnyx.api_base}/v2/phone_numbers/123")
|
90
|
+
.to_return(body: JSON.generate(data: mock_response("123")))
|
91
|
+
command_stub = stub_request(:get, "#{Telnyx.api_base}/v2/phone_numbers/inbound_channels")
|
92
|
+
.to_return(body: JSON.generate(
|
93
|
+
data: {
|
94
|
+
channels: 7,
|
95
|
+
record_type: "inbound_channels",
|
96
|
+
}
|
97
|
+
))
|
98
|
+
phone_number = Telnyx::PhoneNumber.retrieve("123")
|
99
|
+
inbound_channels = phone_number.inbound_channels
|
100
|
+
assert_equal inbound_channels, 7
|
101
|
+
assert_requested command_stub
|
102
|
+
end
|
103
|
+
|
104
|
+
should "update inbound channel" do
|
105
|
+
stub_request(:get, "#{Telnyx.api_base}/v2/phone_numbers/123")
|
106
|
+
.to_return(body: JSON.generate(data: mock_response("123")))
|
107
|
+
stub_request(:get, "#{Telnyx.api_base}/v2/phone_numbers/inbound_channels")
|
108
|
+
.to_return(body: JSON.generate(
|
109
|
+
data: {
|
110
|
+
channels: 7,
|
111
|
+
record_type: "inbound_channels",
|
112
|
+
}
|
113
|
+
))
|
114
|
+
command_stub = stub_request(:patch, "#{Telnyx.api_base}/v2/phone_numbers/inbound_channels")
|
115
|
+
.to_return(body: JSON.generate(
|
116
|
+
data: {
|
117
|
+
channels: 7,
|
118
|
+
record_type: "inbound_channels",
|
119
|
+
}
|
120
|
+
))
|
121
|
+
phone_number = Telnyx::PhoneNumber.retrieve("123")
|
122
|
+
phone_number.update_inbound_channels = 3
|
123
|
+
assert_requested command_stub
|
124
|
+
end
|
87
125
|
end
|
88
126
|
|
89
127
|
def mock_response(id = nil)
|
@@ -5,6 +5,7 @@ require ::File.expand_path("../../test_helper", __FILE__)
|
|
5
5
|
module Telnyx
|
6
6
|
class PublicKeyTest < Test::Unit::TestCase
|
7
7
|
should "be retrievable" do
|
8
|
+
omit "mock spec removed"
|
8
9
|
public_key = Telnyx::PublicKey.retrieve
|
9
10
|
assert_requested :get, "#{Telnyx.api_base}/v2/public_key"
|
10
11
|
assert public_key.is_a?(Telnyx::PublicKey)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "../test_helper"
|
5
|
+
|
6
|
+
module Telnyx
|
7
|
+
class RegulatoryRequirementTest < Test::Unit::TestCase
|
8
|
+
should "be retrievable" do
|
9
|
+
reg_req = RegulatoryRequirement.retrieve "12345"
|
10
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/regulatory_requirements/12345"
|
11
|
+
assert_kind_of RegulatoryRequirement, reg_req
|
12
|
+
end
|
13
|
+
|
14
|
+
should "be listable" do
|
15
|
+
reg_reqs = RegulatoryRequirement.list
|
16
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/regulatory_requirements"
|
17
|
+
assert_kind_of Array, reg_reqs.data
|
18
|
+
assert_kind_of RegulatoryRequirement, reg_reqs.first
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -29,27 +29,15 @@ module Telnyx
|
|
29
29
|
|
30
30
|
context "actions" do
|
31
31
|
should "deactivate" do
|
32
|
-
stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards/123")
|
33
|
-
.to_return(body: JSON.generate(data: { record_type: "sim_card", id: "123" }))
|
34
|
-
|
35
|
-
stub = stub_request(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/deactivate")
|
36
|
-
.to_return(body: JSON.generate(errors: []), status: 202)
|
37
|
-
|
38
32
|
sim = Telnyx::SimCard.retrieve "123"
|
39
33
|
sim.deactivate
|
40
|
-
assert_requested
|
34
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/deactivate")
|
41
35
|
end
|
42
36
|
|
43
37
|
should "activate" do
|
44
|
-
stub_request(:get, "#{Telnyx.api_base}/v2/sim_cards/123")
|
45
|
-
.to_return(body: JSON.generate(data: { record_type: "sim_card", id: "123" }))
|
46
|
-
|
47
|
-
stub = stub_request(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/activate")
|
48
|
-
.to_return(body: JSON.generate(errors: []), status: 202)
|
49
|
-
|
50
38
|
sim = Telnyx::SimCard.retrieve "123"
|
51
39
|
sim.activate
|
52
|
-
assert_requested
|
40
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/activate")
|
53
41
|
end
|
54
42
|
end
|
55
43
|
end
|
@@ -244,7 +244,7 @@ module Telnyx
|
|
244
244
|
.to_return(body: JSON.generate(object: "account"))
|
245
245
|
|
246
246
|
client = TelnyxClient.new
|
247
|
-
client.execute_request(:post, "/v2/messaging_profiles")
|
247
|
+
client.execute_request(:post, "/v2/messaging_profiles", params: { name: "foobar" })
|
248
248
|
ensure
|
249
249
|
Telnyx.telnyx_account = old
|
250
250
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../test_helper"
|
4
|
+
module Telnyx
|
5
|
+
class WirelessDetailRecordsReportTest < Test::Unit::TestCase
|
6
|
+
should "list detail records report" do
|
7
|
+
stub = stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports")
|
8
|
+
.to_return(body: JSON.generate(data: [FIXTURE]))
|
9
|
+
detail_records_report = WirelessDetailRecordsReport.list
|
10
|
+
# assert_requested :get, "#{Telnyx.api_base}/v2/detail_records_report"
|
11
|
+
assert_requested stub
|
12
|
+
assert_kind_of ListObject, detail_records_report
|
13
|
+
assert_kind_of WirelessDetailRecordsReport, detail_records_report.first
|
14
|
+
end
|
15
|
+
|
16
|
+
should "create detail records report" do
|
17
|
+
stub = stub_request(:post, "#{Telnyx.api_base}/v2/wireless/detail_records_reports")
|
18
|
+
.to_return(body: JSON.generate(data: FIXTURE))
|
19
|
+
detail_records_report = WirelessDetailRecordsReport.create
|
20
|
+
# assert_requested :post, "#{Telnyx.api_base}/v2/detail_records_report"
|
21
|
+
assert_requested stub
|
22
|
+
assert_kind_of WirelessDetailRecordsReport, detail_records_report
|
23
|
+
end
|
24
|
+
|
25
|
+
should "retrieve detail records report" do
|
26
|
+
stub = stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
|
27
|
+
.to_return(body: JSON.generate(data: FIXTURE))
|
28
|
+
detail_records_report = WirelessDetailRecordsReport.retrieve("id")
|
29
|
+
# assert_requested :get, "#{Telnyx.api_base}/v2/detail_records_report/id"
|
30
|
+
assert_requested stub
|
31
|
+
assert_kind_of WirelessDetailRecordsReport, detail_records_report
|
32
|
+
end
|
33
|
+
|
34
|
+
should "delete detail records report" do
|
35
|
+
stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
|
36
|
+
.to_return(body: JSON.generate(data: FIXTURE))
|
37
|
+
stub = stub_request(:delete, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
|
38
|
+
.to_return(body: JSON.generate(data: FIXTURE))
|
39
|
+
detail_records_report = WirelessDetailRecordsReport.retrieve("id")
|
40
|
+
|
41
|
+
detail_records_report.delete
|
42
|
+
# assert_requested :delete, "#{Telnyx.api_base}/v2/detail_records_report/id"
|
43
|
+
assert_requested stub
|
44
|
+
end
|
45
|
+
|
46
|
+
FIXTURE = {
|
47
|
+
"created_at" => "2018-02-02T22:25:27.521Z",
|
48
|
+
"id" => "id",
|
49
|
+
"record_type" => "detail_records_report",
|
50
|
+
"updated_at" => "2018-02-02T22:25:27.521Z",
|
51
|
+
"end_time" => "2018-02-02T22:25:27.521Z",
|
52
|
+
"start_time" => "2018-02-02T22:25:27.521Z",
|
53
|
+
"report_url" => "http://example.com",
|
54
|
+
"status" => "pending",
|
55
|
+
}.freeze
|
56
|
+
end
|
57
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
|
|
17
17
|
require ::File.expand_path("../telnyx_mock", __FILE__)
|
18
18
|
|
19
19
|
# If changing this number, please also change it in `.travis.yml`.
|
20
|
-
MOCK_MINIMUM_VERSION = "0.
|
20
|
+
MOCK_MINIMUM_VERSION = "0.8.9".freeze
|
21
21
|
MOCK_PORT = Telnyx::TelnyxMock.start
|
22
22
|
|
23
23
|
# Disable all real network connections except those that are outgoing to
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telnyx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Telnyx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- VERSION
|
93
93
|
- bin/telnyx-console
|
94
94
|
- lib/telnyx.rb
|
95
|
+
- lib/telnyx/address.rb
|
95
96
|
- lib/telnyx/alphanumeric_sender_id.rb
|
96
97
|
- lib/telnyx/api_operations/create.rb
|
97
98
|
- lib/telnyx/api_operations/delete.rb
|
@@ -102,18 +103,31 @@ files:
|
|
102
103
|
- lib/telnyx/api_operations/save.rb
|
103
104
|
- lib/telnyx/api_resource.rb
|
104
105
|
- lib/telnyx/available_phone_number.rb
|
106
|
+
- lib/telnyx/billing_group.rb
|
105
107
|
- lib/telnyx/call.rb
|
106
|
-
- lib/telnyx/
|
108
|
+
- lib/telnyx/call_control_application.rb
|
109
|
+
- lib/telnyx/conference.rb
|
110
|
+
- lib/telnyx/connection.rb
|
111
|
+
- lib/telnyx/credential_connection.rb
|
107
112
|
- lib/telnyx/errors.rb
|
108
113
|
- lib/telnyx/event.rb
|
114
|
+
- lib/telnyx/fqdn.rb
|
115
|
+
- lib/telnyx/fqdn_connection.rb
|
116
|
+
- lib/telnyx/ip.rb
|
117
|
+
- lib/telnyx/ip_connection.rb
|
109
118
|
- lib/telnyx/list_object.rb
|
110
119
|
- lib/telnyx/message.rb
|
111
120
|
- lib/telnyx/messaging_phone_number.rb
|
112
121
|
- lib/telnyx/messaging_profile.rb
|
113
122
|
- lib/telnyx/number_order.rb
|
123
|
+
- lib/telnyx/number_order_document.rb
|
114
124
|
- lib/telnyx/number_reservation.rb
|
125
|
+
- lib/telnyx/outbound_voice_profile.rb
|
115
126
|
- lib/telnyx/phone_number.rb
|
127
|
+
- lib/telnyx/phone_number_regulatory_requirement.rb
|
128
|
+
- lib/telnyx/portout.rb
|
116
129
|
- lib/telnyx/public_key.rb
|
130
|
+
- lib/telnyx/regulatory_requirement.rb
|
117
131
|
- lib/telnyx/sim_card.rb
|
118
132
|
- lib/telnyx/singleton_api_resource.rb
|
119
133
|
- lib/telnyx/telnyx_client.rb
|
@@ -122,30 +136,45 @@ files:
|
|
122
136
|
- lib/telnyx/util.rb
|
123
137
|
- lib/telnyx/version.rb
|
124
138
|
- lib/telnyx/webhook.rb
|
139
|
+
- lib/telnyx/wireless_detail_records_report.rb
|
125
140
|
- telnyx.gemspec
|
126
141
|
- test/api_stub_helpers.rb
|
127
142
|
- test/openapi/README.md
|
143
|
+
- test/telnyx/address_test.rb
|
128
144
|
- test/telnyx/alphanumeric_sender_id_test.rb
|
129
145
|
- test/telnyx/api_operations_test.rb
|
130
146
|
- test/telnyx/api_resource_test.rb
|
131
147
|
- test/telnyx/available_phone_number_test.rb
|
148
|
+
- test/telnyx/billing_group_test.rb
|
149
|
+
- test/telnyx/call_control_application_test.rb
|
132
150
|
- test/telnyx/call_control_test.rb
|
133
|
-
- test/telnyx/
|
151
|
+
- test/telnyx/conference_test.rb
|
152
|
+
- test/telnyx/connection_test.rb
|
153
|
+
- test/telnyx/credential_connection_test.rb
|
134
154
|
- test/telnyx/errors_test.rb
|
155
|
+
- test/telnyx/fqdn_connection_test.rb
|
156
|
+
- test/telnyx/fqdn_test.rb
|
157
|
+
- test/telnyx/ip_connection_test.rb
|
158
|
+
- test/telnyx/ip_test.rb
|
135
159
|
- test/telnyx/list_object_test.rb
|
136
160
|
- test/telnyx/message_test.rb
|
137
161
|
- test/telnyx/messaging_phone_number_test.rb
|
138
162
|
- test/telnyx/messaging_profile_test.rb
|
163
|
+
- test/telnyx/number_order_document_test.rb
|
139
164
|
- test/telnyx/number_order_test.rb
|
140
165
|
- test/telnyx/number_reservation_test.rb
|
166
|
+
- test/telnyx/outbound_voice_profile_test.rb
|
167
|
+
- test/telnyx/phone_number_regulatory_requirement_test.rb
|
141
168
|
- test/telnyx/phone_number_test.rb
|
142
169
|
- test/telnyx/public_key_test.rb
|
170
|
+
- test/telnyx/regulatory_requirement_test.rb
|
143
171
|
- test/telnyx/sim_card_test.rb
|
144
172
|
- test/telnyx/telnyx_client_test.rb
|
145
173
|
- test/telnyx/telnyx_object_test.rb
|
146
174
|
- test/telnyx/telnyx_response_test.rb
|
147
175
|
- test/telnyx/util_test.rb
|
148
176
|
- test/telnyx/webhook_test.rb
|
177
|
+
- test/telnyx/wireless_detail_records_report_test.rb
|
149
178
|
- test/telnyx_mock.rb
|
150
179
|
- test/telnyx_test.rb
|
151
180
|
- test/test_data.rb
|
@@ -173,34 +202,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
202
|
- !ruby/object:Gem::Version
|
174
203
|
version: '0'
|
175
204
|
requirements: []
|
176
|
-
|
205
|
+
rubyforge_project:
|
206
|
+
rubygems_version: 2.7.6
|
177
207
|
signing_key:
|
178
208
|
specification_version: 4
|
179
209
|
summary: Ruby bindings for the Telnyx API
|
180
210
|
test_files:
|
181
211
|
- test/api_stub_helpers.rb
|
182
212
|
- test/openapi/README.md
|
213
|
+
- test/telnyx/address_test.rb
|
183
214
|
- test/telnyx/alphanumeric_sender_id_test.rb
|
184
215
|
- test/telnyx/api_operations_test.rb
|
185
216
|
- test/telnyx/api_resource_test.rb
|
186
217
|
- test/telnyx/available_phone_number_test.rb
|
218
|
+
- test/telnyx/billing_group_test.rb
|
219
|
+
- test/telnyx/call_control_application_test.rb
|
187
220
|
- test/telnyx/call_control_test.rb
|
188
|
-
- test/telnyx/
|
221
|
+
- test/telnyx/conference_test.rb
|
222
|
+
- test/telnyx/connection_test.rb
|
223
|
+
- test/telnyx/credential_connection_test.rb
|
189
224
|
- test/telnyx/errors_test.rb
|
225
|
+
- test/telnyx/fqdn_connection_test.rb
|
226
|
+
- test/telnyx/fqdn_test.rb
|
227
|
+
- test/telnyx/ip_connection_test.rb
|
228
|
+
- test/telnyx/ip_test.rb
|
190
229
|
- test/telnyx/list_object_test.rb
|
191
230
|
- test/telnyx/message_test.rb
|
192
231
|
- test/telnyx/messaging_phone_number_test.rb
|
193
232
|
- test/telnyx/messaging_profile_test.rb
|
233
|
+
- test/telnyx/number_order_document_test.rb
|
194
234
|
- test/telnyx/number_order_test.rb
|
195
235
|
- test/telnyx/number_reservation_test.rb
|
236
|
+
- test/telnyx/outbound_voice_profile_test.rb
|
237
|
+
- test/telnyx/phone_number_regulatory_requirement_test.rb
|
196
238
|
- test/telnyx/phone_number_test.rb
|
197
239
|
- test/telnyx/public_key_test.rb
|
240
|
+
- test/telnyx/regulatory_requirement_test.rb
|
198
241
|
- test/telnyx/sim_card_test.rb
|
199
242
|
- test/telnyx/telnyx_client_test.rb
|
200
243
|
- test/telnyx/telnyx_object_test.rb
|
201
244
|
- test/telnyx/telnyx_response_test.rb
|
202
245
|
- test/telnyx/util_test.rb
|
203
246
|
- test/telnyx/webhook_test.rb
|
247
|
+
- test/telnyx/wireless_detail_records_report_test.rb
|
204
248
|
- test/telnyx_mock.rb
|
205
249
|
- test/telnyx_test.rb
|
206
250
|
- test/test_data.rb
|