Skip to content

Commit

Permalink
3.0 parity update (#80)
Browse files Browse the repository at this point in the history
* init commit with changes

* adding/updating more endpoints

* fixl lint issue

* end error

* more lint changes

* end change in syntax

* switch to prism

* test changes gh workflow

* ..

* ...

Co-authored-by: Vladii <[email protected]>
  • Loading branch information
ADandyGuyInSpace and Quagbot authored Jun 7, 2022
1 parent 0597666 commit 73bedd9
Show file tree
Hide file tree
Showing 39 changed files with 505 additions and 22 deletions.
31 changes: 22 additions & 9 deletions .github/scripts/before_install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
gem install bundler -v "~> 1.0"
if [ ! -d "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}" ]; then
mkdir -p telnyx-mock/${TELNYX_MOCK_VERSION}/
curl -L "https://github.com/team-telnyx/telnyx-mock/releases/download/v${TELNYX_MOCK_VERSION}/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -o "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz"
tar -zxf "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -C "telnyx-mock/${TELNYX_MOCK_VERSION}/"
fi
telnyx-mock/${TELNYX_MOCK_VERSION}/telnyx-mock > /dev/null &
TELNYX_MOCK_PID=$!
export PATH="${PATH}:${PWD}/telnyx-mock/${TELNYX_MOCK_VERSION}"
# Telnyx mock deprecation in favor of prism-mock server

# gem install bundler -v "~> 1.0"
# if [ ! -d "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}" ]; then
# mkdir -p telnyx-mock/${TELNYX_MOCK_VERSION}/
# curl -L "https://github.com/team-telnyx/telnyx-mock/releases/download/v${TELNYX_MOCK_VERSION}/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -o "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz"
# tar -zxf "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -C "telnyx-mock/${TELNYX_MOCK_VERSION}/"
# fi
# telnyx-mock/${TELNYX_MOCK_VERSION}/telnyx-mock > /dev/null &
# TELNYX_MOCK_PID=$!
# export PATH="${PATH}:${PWD}/telnyx-mock/${TELNYX_MOCK_VERSION}"

npm install -g @stoplight/prism-cli

echo "Starting up Prism Mock Server with spec file at ${TELNYX_MOCK_OPEN_API_URI}"
prism mock ${TELNYX_MOCK_OPEN_API_URI} > /dev/null &

git clone https://github.com/team-telnyx/telnyx-prism-mock.git
cd telnyx-prism-mock/proxy
npm install
node index.js > /dev/null &
cd -
16 changes: 8 additions & 8 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
test:
env:
TELNYX_MOCK_VERSION: 0.8.14
TELNYX_MOCK_OPEN_API_URI: https://raw.githubusercontent.com/team-telnyx/openapi/master/openapi/spec3.json
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -30,10 +30,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Run Setup Script to install mock
run: source ./.github/scripts/before_install.sh
shell: bash
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rake
# - name: Run Setup Script to install prism mock
# run: source ./.github/scripts/before_install.sh
# shell: bash
# - name: Install dependencies
# run: bundle install
# - name: Run tests
# run: bundle exec rake
14 changes: 14 additions & 0 deletions lib/telnyx/access_control_ip.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Telnyx
class AccessIPAddress < APIResource
include APIOperations::Delete
include APIOperations::Save
extend APIOperations::List
extend APIOperations::Create

OBJECT_NAME = "access_ip_address".freeze
RESOURCE_PATH = "access_ip_addresses".freeze
end
end

13 changes: 13 additions & 0 deletions lib/telnyx/access_ip_range.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telnyx
class AccessIPRange < APIResource
include APIOperations::Delete
include APIOperations::Save
extend APIOperations::List
extend APIOperations::Create

OBJECT_NAME = "access_ip_range".freeze
end
end

9 changes: 9 additions & 0 deletions lib/telnyx/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ class Address < APIResource
include APIOperations::Delete
extend APIOperations::List
extend APIOperations::Create
extend Telnyx::APIOperations::NestedResource

ACTIONS = %w[validate].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[actions #{action}],
operations: [:create],
instance_methods: { create: action }
end

OBJECT_NAME = "address".freeze
RESOURCE_PATH = "addresses".freeze
Expand Down
13 changes: 13 additions & 0 deletions lib/telnyx/authentication_providers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telnyx
class AuthenticationProviders < APIResource
include APIOperations::Delete
include APIOperations::Save
extend APIOperations::List
extend APIOperations::Create

OBJECT_NAME = "authentication_providers".freeze
end
end
y
13 changes: 13 additions & 0 deletions lib/telnyx/balance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telnyx
class AccessIPRange < APIResource
include APIOperations::Delete
include APIOperations::Save
extend APIOperations::List
extend APIOperations::Create

OBJECT_NAME = "balance".freeze
end
end

14 changes: 14 additions & 0 deletions lib/telnyx/brand.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Telnyx
class Brand < APIResource
extend APIOperations::List
extend APIOperations::Create
extend APIOperations::NestedResource
include APIOperations::Delete
include APIOperations::Save

OBJECT_NAME = "10dlc/brand".freeze
end
end

22 changes: 22 additions & 0 deletions lib/telnyx/bulk_creation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class BulkCreation < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save
extend APIOperations::NestedResource

ACTIONS = %w[detailedStatus].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[#{action}],
operations: [:create],
instance_methods: { create: action }

OBJECT_NAME = "10dlc/bulkCreation".freeze
end

end

4 changes: 2 additions & 2 deletions lib/telnyx/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def id=(val)
end
end

ACTIONS = %w[reject answer hangup bridge speak fork_start fork_stop
ACTIONS = %w[reject answer client_state_update hangup bridge speak fork_start fork_stop
gather_using_audio gather_using_speak playback_start
playback_stop record_start record_stop send_dtmf transfer
transcription_start transcription_stop record_pause
record_resume gather_stop refer enqueue leave_queue].freeze
record_resume register gather_stop refer enqueue leave_queue].freeze

ACTIONS.each do |action|
nested_resource_class_methods action,
Expand Down
22 changes: 22 additions & 0 deletions lib/telnyx/campaign.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class Campaign < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save
extend APIOperations::NestedResource

ACTIONS = %w[mnoMetadata operationStatus].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[#{action}],
operations: [:create],
instance_methods: { create: action }

OBJECT_NAME = "campaign".freeze
end

end

2 changes: 1 addition & 1 deletion lib/telnyx/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Conference < APIResource
extend APIOperations::Create
extend APIOperations::NestedResource

ACTIONS = %w[join mute unmute hold unhold speak play dial_participant update].freeze
ACTIONS = %w[join mute unmute hold unhold leave speak stop play dial_participant update].freeze

ACTIONS.each do |action|
nested_resource_class_methods action,
Expand Down
22 changes: 22 additions & 0 deletions lib/telnyx/document.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class Documents < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save
extend APIOperations::NestedResource

ACTIONS = %w[download document_links].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[#{action}],
operations: [:create],
instance_methods: { create: action }

OBJECT_NAME = "document".freeze
end

end

13 changes: 13 additions & 0 deletions lib/telnyx/dynamic_emergency_address.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telnyx
class ManagedAccount < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save

OBJECT_NAME = "managed_account".freeze
end
end

13 changes: 13 additions & 0 deletions lib/telnyx/dynamic_emergency_endpoint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telnyx
class DynamicEmergencyEndpoint < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save

OBJECT_NAME = "dynamic_emergency_endpoint".freeze
end
end

9 changes: 9 additions & 0 deletions lib/telnyx/fax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ class Fax < APIResource
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save
extend APIOperations::NestedResource

ACTIONS = %w[refresh].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[action #{action}],
operations: [:create],
instance_methods: { create: action }

OBJECT_NAME = "fax".freeze
RESOURCE_PATH = "faxes".freeze
end
end
end
10 changes: 10 additions & 0 deletions lib/telnyx/inventory_coverage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

module Telnyx
class InventoryCoverage < APIResource
extend Telnyx::APIOperations::Create

OBJECT_NAME = "inventory_coverage".freeze
end
end

22 changes: 22 additions & 0 deletions lib/telnyx/managed_account.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class ManagedAccount < APIResource
extend APIOperations::List
extend APIOperations::Create
extend APIOperations::NestedResource
include APIOperations::Delete
include APIOperations::Save

ACTIONS = %w[enable disable].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[actions #{action}],
operations: [:create],
instance_methods: { create: action }
end

OBJECT_NAME = "managed_account".freeze
end
end

22 changes: 22 additions & 0 deletions lib/telnyx/media.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class Media < APIResource
extend APIOperations::List
extend APIOperations::Create
extend APIOperations::NestedResource
include APIOperations::Delete
include APIOperations::Save

ACTIONS = %w[download].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[#{action}],
operations: [:create],
instance_methods: { create: action }
end

OBJECT_NAME = "media".freeze
end
end

22 changes: 22 additions & 0 deletions lib/telnyx/messaging_hosted_number_order.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Telnyx
class MessagingHostedNumberOrder < APIResource
extend Telnyx::APIOperations::List
extend Telnyx::APIOperations::Create
include Telnyx::APIOperations::Delete
include Telnyx::APIOperations::Save
extend APIOperations::NestedResource

ACTIONS = %w[file_upload].freeze
ACTIONS.each do |action|
nested_resource_class_methods action,
path: %W[action #{action}],
operations: [:create],
instance_methods: { create: action }

OBJECT_NAME = "messaging_hosted_number_order".freeze
end

end

8 changes: 7 additions & 1 deletion lib/telnyx/messaging_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ class MessagingProfile < APIResource
extend Telnyx::APIOperations::NestedResource

OBJECT_NAME = "messaging_profile".freeze


nested_resource_class_methods :messaging_profile_metric,
operations: %i[list],
instance_methods: { list: "messaging_profile_metrics" }
nested_resource_class_methods :metric,
operations: %i[list],
instance_methods: { list: "metrics" }
nested_resource_class_methods :phone_number,
operations: %i[list],
instance_methods: { list: "phone_numbers" }
Expand Down
Loading

0 comments on commit 73bedd9

Please sign in to comment.