telnyx 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 927c50209752403c6195640304e8347c3976accd6b47482b0a3d4c1555620a0d
4
- data.tar.gz: a1e2949af48a5de6e2acc95beb81b82155261b7f0e96f1fb908172ed815bef30
3
+ metadata.gz: 5be54d16caf13e685a75cbfd110887e83dc2dce545f31174a31fe81e6812edac
4
+ data.tar.gz: c614552e81376c52708450f026de087f027b77f12d51bdf35be139c94a2b3583
5
5
  SHA512:
6
- metadata.gz: 11f180c0a27812562112cc97374e64234898c5c4c4ca5e9c1bed9a0828013837f246ea8f3e822b542044d8862887deb6638f51457fc2ff5cc9d69571c24d32ed
7
- data.tar.gz: ba3017fe223168af6248ed3a57e6dc50444aa08607ecbce4295453997081b2dce9e13f1e39208a13392961d59e4c0195a3a841fb7f240791e5d5561558a64bd7
6
+ metadata.gz: 9bc852c96c976262f1626df33ed8d7e267994ef7bbff8cff627bf5069af14b78248e38685cceb5cd4ea3a7dd29991e6f0cf85cfa214e19eb3ee2d6893937131c
7
+ data.tar.gz: df43a6367eecb402752fb6a6b4603c7caada2eee86c2b951cafcb861790fefbfc54d4583f3a0dde976112020bc4d7726e50e581332c0a79a6da9f76ebc128b57
@@ -3,33 +3,33 @@ on:
3
3
  types: [released]
4
4
 
5
5
  jobs:
6
- test:
7
- env:
8
- TELNYX_MOCK_OPEN_API_URI: https://raw.githubusercontent.com/team-telnyx/openapi/master/openapi/spec3.json
9
- runs-on: ubuntu-latest
10
- strategy:
11
- matrix:
12
- ruby: [ '3.0', '3.1', '3.2' ]
13
- steps:
14
- - uses: actions/checkout@v4
15
- - name: Set up Ruby
6
+ #Deprecating, incoming replacement for self-hosted mock service
7
+ #test:
8
+ #env:
9
+ # TELNYX_MOCK_OPEN_API_URI: https://raw.githubusercontent.com/team-telnyx/openapi/master/openapi/spec3.json
10
+ #runs-on: ubuntu-latest
11
+ #strategy:
12
+ # matrix:
13
+ # ruby: [ '3.0', '3.1', '3.2' ]
14
+ #steps:
15
+ #- uses: actions/checkout@v4
16
+ #- name: Set up Ruby
16
17
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
17
18
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
18
19
  # uses: ruby/setup-ruby@v1
19
- uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: ${{ matrix.ruby }}
22
- - name: Run Setup Script to install prism mock
23
- run: source ./.github/scripts/before_install.sh
24
- shell: bash
25
- - name: Install dependencies
26
- run: bundle install
27
- - name: Run tests
28
- run: bundle exec rake
20
+ # uses: ruby/setup-ruby@v1
21
+ # with:
22
+ # ruby-version: ${{ matrix.ruby }}
23
+ #- name: Run Setup Script to install prism mock
24
+ # run: source ./.github/scripts/before_install.sh
25
+ # shell: bash
26
+ #- name: Install dependencies
27
+ # run: bundle install
28
+ #- name: Run tests
29
+ # run: bundle exec rake
29
30
 
30
31
  build_and_publish_gem:
31
32
  name: Build + Publish Gem
32
- needs: test
33
33
  runs-on: ubuntu-latest
34
34
  permissions:
35
35
  packages: write
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 3.0.3
data/lib/telnyx/brand.rb CHANGED
@@ -2,19 +2,13 @@
2
2
 
3
3
  module Telnyx
4
4
  class Brand < APIResource
5
- extend APIOperations::List
6
- extend APIOperations::Create
5
+ extend Telnyx::APIOperations::Create
6
+ extend Telnyx::APIOperations::List
7
+ include Telnyx::APIOperations::Save
8
+ include Telnyx::APIOperations::Delete
7
9
  extend APIOperations::NestedResource
8
- include APIOperations::Delete
9
- include APIOperations::Save
10
-
11
- def self.resource_url(inner_id = nil)
12
- path_prefix = "/10dlc"
13
- object_path = "brand"
14
-
15
- inner_id.nil? ? "#{path_prefix}/#{object_path}" : "#{path_prefix}/#{object_path}/#{CGI.escape(inner_id)}"
16
- end
17
10
 
18
11
  OBJECT_NAME = "brand".freeze
12
+ RESOURCE_PATH = "brand".freeze
19
13
  end
20
14
  end
@@ -15,6 +15,11 @@ module Telnyx
15
15
  operations: [:create],
16
16
  instance_methods: { create: action }
17
17
  end
18
+ def self.create(params = {}, opts = {})
19
+ resp, opts = request(:post, "/10dlc/campaignBuilder", params, opts)
20
+ Util.convert_to_telnyx_object(resp.data, opts)
21
+ end
22
+
18
23
  def accept_sharing(params = {}, opts = {})
19
24
  resp, opts = request(:post, "/10dlc/campaign/acceptSharing/#{campaignId.gsub(/\s+/, '+')}", params, opts)
20
25
  Util.convert_to_telnyx_object(resp.data, opts)
@@ -30,6 +35,11 @@ module Telnyx
30
35
  Util.convert_to_telnyx_object(resp.data, opts)
31
36
  end
32
37
 
38
+ def self.retrieve(id, opts = {})
39
+ resp, opts = request(:get, resource_url(id), {}, opts)
40
+ Util.convert_to_telnyx_object(resp.data, opts)
41
+ end
42
+
33
43
  def self.resource_url(inner_id = nil)
34
44
  path_prefix = "/10dlc"
35
45
  object_path = "campaign"
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ class MessagingHostedNumber < APIResource
5
+ include Telnyx::APIOperations::Delete
6
+
7
+ def self.resource_url(inner_id = nil)
8
+ path_prefix = "/v2"
9
+ object_path = "messaging_hosted_numbers"
10
+
11
+ inner_id.nil? ? "#{path_prefix}/#{object_path}" : "#{path_prefix}/#{object_path}/#{CGI.escape(inner_id)}"
12
+ end
13
+
14
+ OBJECT_NAME = "messaging_hosted_number".freeze
15
+ end
16
+ end
@@ -17,5 +17,10 @@ module Telnyx
17
17
  end
18
18
 
19
19
  OBJECT_NAME = "messaging_hosted_number_order".freeze
20
+
21
+ def upload_file(params = {}, opts = {})
22
+ resp, opts = request(:post, "#{resource_url}/actions/file_upload", params, opts)
23
+ Util.convert_to_telnyx_object(resp.data, opts)
24
+ end
20
25
  end
21
26
  end
@@ -46,7 +46,11 @@ module Telnyx
46
46
  Util.convert_to_telnyx_object(resp.data, opts)
47
47
  end
48
48
 
49
- # depreciated api
49
+ def self.retrieve(id, params = {}, opts = {})
50
+ resp, opts = request(:get, "/v2/sim_cards/#{id}", params, opts)
51
+ Util.convert_to_telnyx_object(resp.data, opts)
52
+ end
53
+
50
54
  def activate
51
55
  warn "[DEPRECATION] SimCard#activate is deprecated, use enable instead."
52
56
  enable
@@ -3,6 +3,10 @@
3
3
  module Telnyx
4
4
  class TexmlApplication < APIResource
5
5
  extend Telnyx::APIOperations::List
6
+ extend Telnyx::APIOperations::Create
7
+ include Telnyx::APIOperations::Delete
8
+ include Telnyx::APIOperations::Save
9
+ extend APIOperations::NestedResource
6
10
 
7
11
  OBJECT_NAME = "texml_application".freeze
8
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Telnyx
4
- VERSION = "3.0.2".freeze
4
+ VERSION = "3.0.3".freeze
5
5
  end
data/lib/telnyx.rb CHANGED
@@ -87,6 +87,8 @@ require "telnyx/mdr_usage_report"
87
87
  require "telnyx/message"
88
88
  require "telnyx/message_number_pool"
89
89
  require "telnyx/messaging_phone_number"
90
+ require "telnyx/messaging_hosted_number_order"
91
+ require "telnyx/messaging_hosted_number"
90
92
  require "telnyx/messaging_profile"
91
93
  require "telnyx/messaging_tollfree_verification"
92
94
  require "telnyx/messaging_url_domain"
data/server.js CHANGED
@@ -23,7 +23,7 @@ proxy.on('error', (err, req, res) => {
23
23
  });
24
24
 
25
25
  // Choose the port for the proxy server
26
- const PORT = 8000; // You can choose any available port
26
+ const PORT = 12111; // You can choose any available port
27
27
 
28
28
  // Start the server
29
29
  server.listen(PORT, () => {
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class BrandTest < Test::Unit::TestCase
7
+ should "create a brand" do
8
+ brand = Telnyx::Brand.create(
9
+ name: "Test Brand",
10
+ ein: "123456789",
11
+ ein_issuing_country: "US",
12
+ entity_type: "PRIVATE_PROFIT",
13
+ registration_status: "REGISTERED",
14
+ vertical: "COMMUNICATION",
15
+ displayName: "Test Display Name",
16
+ country: "US",
17
+ email: "test@example.com"
18
+ )
19
+ assert_requested :post, "#{Telnyx.api_base}/brand"
20
+ assert brand.is_a?(Telnyx::Brand)
21
+ end
22
+
23
+ should "list brands" do
24
+ brands = Telnyx::Brand.list
25
+ assert_requested :get, "#{Telnyx.api_base}/brand"
26
+ assert brands.data.is_a?(Array)
27
+ assert brands.data[0].is_a?(Telnyx::Brand)
28
+ end
29
+
30
+ should "retrieve a brand" do
31
+ brand = Telnyx::Brand.retrieve("123")
32
+ assert_requested :get, "#{Telnyx.api_base}/brand/123"
33
+ assert brand.is_a?(Telnyx::Brand)
34
+ end
35
+
36
+ should "update a brand" do
37
+ brand = Telnyx::Brand.retrieve("123")
38
+ brand.name = "Updated Brand"
39
+ brand.save
40
+ assert_requested :patch, "#{Telnyx.api_base}/brand/123"
41
+ end
42
+
43
+ should "delete a brand" do
44
+ brand = Telnyx::Brand.retrieve("123")
45
+ brand.delete
46
+ assert_requested :delete, "#{Telnyx.api_base}/brand/123"
47
+ end
48
+ end
49
+ end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../test_helper"
4
-
5
- module Telnyx
6
- class CampaignTest < Test::Unit::TestCase
7
- should "retrieve campaign" do
8
- omit "ID req mismatch"
9
- campaign = Campaign.retrieve("id")
10
- assert_requested :get, "#{Telnyx.api_base}/v2/campaign/id"
11
- assert_kind_of Campaign, campaign
12
- end
13
-
14
- should "accept_sharing campaign" do
15
- omit "ID req mismatch"
16
- campaign = Campaign.retrieve("id")
17
- id = campaign.campaignId.gsub(/\s+/, "+").freeze
18
- campaign.accept_sharing
19
-
20
- assert_requested :post, "#{Telnyx.api_base}/v2/campaign/acceptSharing/#{id}"
21
- end
22
-
23
- should "get asr_attributes" do
24
- omit "ID req mismatch"
25
- campaign = Campaign.retrieve("id")
26
- id = campaign.campaignId.gsub(/\s+/, "+").freeze
27
- campaign.osr_attributes
28
-
29
- assert_requested :get, "#{Telnyx.api_base}/v2/campaign/#{id}/osr/attributes"
30
- end
31
- end
32
- end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ class MessagingHostedNumberOrderTest < Test::Unit::TestCase
5
+ should "be retrievable" do
6
+ order = Telnyx::MessagingHostedNumberOrder.retrieve("123")
7
+ assert_requested :get, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders/123"
8
+ assert order.is_a?(Telnyx::MessagingHostedNumberOrder)
9
+ end
10
+
11
+ should "be able to upload a file" do
12
+ omit "file path doesn't exist, prism mock error"
13
+ order = Telnyx::MessagingHostedNumberOrder.retrieve("123")
14
+ file_upload = order.upload_file(
15
+ loa: File.new("path/to/loa.pdf"),
16
+ bill: File.new("path/to/bill.pdf")
17
+ )
18
+ assert_requested :post, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders/123/actions/file_upload"
19
+ assert file_upload.is_a?(Telnyx::TelnyxObject)
20
+ end
21
+
22
+ should "be creatable" do
23
+ order = Telnyx::MessagingHostedNumberOrder.create(
24
+ phone_number: "+1234567890",
25
+ messaging_profile_id: "456"
26
+ )
27
+ assert_requested :post, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders"
28
+ assert order.is_a?(Telnyx::MessagingHostedNumberOrder)
29
+ end
30
+
31
+ should "be listable" do
32
+ orders = Telnyx::MessagingHostedNumberOrder.list
33
+ assert_requested :get, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders"
34
+ assert orders.data.is_a?(Array)
35
+ assert orders.data[0].is_a?(Telnyx::MessagingHostedNumberOrder)
36
+ end
37
+ end
38
+ end
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: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Telnyx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -187,6 +187,7 @@ files:
187
187
  - lib/telnyx/media.rb
188
188
  - lib/telnyx/message.rb
189
189
  - lib/telnyx/message_number_pool.rb
190
+ - lib/telnyx/messaging_hosted_number.rb
190
191
  - lib/telnyx/messaging_hosted_number_order.rb
191
192
  - lib/telnyx/messaging_phone_number.rb
192
193
  - lib/telnyx/messaging_profile.rb
@@ -267,6 +268,7 @@ files:
267
268
  - test/telnyx/available_phone_number_test.rb
268
269
  - test/telnyx/batch_mdr_report_test.rb
269
270
  - test/telnyx/billing_group_test.rb
271
+ - test/telnyx/brand_test.rb
270
272
  - test/telnyx/bulk_credential_test.rb
271
273
  - test/telnyx/bulk_sim_card_action_test.rb
272
274
  - test/telnyx/business_identitie_test.rb
@@ -309,6 +311,7 @@ files:
309
311
  - test/telnyx/mdr_usage_report_test.rb
310
312
  - test/telnyx/message_number_pool_test.rb
311
313
  - test/telnyx/message_test.rb
314
+ - test/telnyx/messaging_hosted_number_order_test.rb
312
315
  - test/telnyx/messaging_phone_number_test.rb
313
316
  - test/telnyx/messaging_profile_test.rb
314
317
  - test/telnyx/messaging_tollfree_verification_test.rb
@@ -404,6 +407,7 @@ test_files:
404
407
  - test/telnyx/available_phone_number_test.rb
405
408
  - test/telnyx/batch_mdr_report_test.rb
406
409
  - test/telnyx/billing_group_test.rb
410
+ - test/telnyx/brand_test.rb
407
411
  - test/telnyx/bulk_credential_test.rb
408
412
  - test/telnyx/bulk_sim_card_action_test.rb
409
413
  - test/telnyx/business_identitie_test.rb
@@ -446,6 +450,7 @@ test_files:
446
450
  - test/telnyx/mdr_usage_report_test.rb
447
451
  - test/telnyx/message_number_pool_test.rb
448
452
  - test/telnyx/message_test.rb
453
+ - test/telnyx/messaging_hosted_number_order_test.rb
449
454
  - test/telnyx/messaging_phone_number_test.rb
450
455
  - test/telnyx/messaging_profile_test.rb
451
456
  - test/telnyx/messaging_tollfree_verification_test.rb