Sha256: e5ff18302d88c7ffae9c0495cd7cf2e15cf65c1f93c697befa6fbdc37274e9fc

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

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

    nested_resource_class_methods "voice",
                                  path: ["voice"],
                                  operations: %i[update list],
                                  instance_methods: { list: "voice" }
    nested_resource_class_methods "messaging",
                                  path: ["messaging"],
                                  operations: %i[update list retrieve],
                                  instance_methods: { list: "messaging" }
    nested_resource_class_methods "inbound_channel",
                                  path: ["inbound_channels"],
                                  operations: %i[update list]

    def update_messaging(opts)
      self.class.update_messaging(id, nil, opts)
    end

    def update_voice(opts)
      self.class.update_voice(id, nil, opts)
    end

    def update_inbound_channels=(val)
      self.class.update_inbound_channel(nil, nil, channels: val)
    end

    def inbound_channels
      self.class.list_inbound_channels(nil).channels
    end

    def self.list_voice(*args, **kwargs)
      list_voices(nil, *args, **kwargs)
    end

    def self.messaging
      list_messagings(nil)
    end

    OBJECT_NAME = "phone_number".freeze
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telnyx-2.9.0 lib/telnyx/phone_number.rb
telnyx-2.8.0 lib/telnyx/phone_number.rb
telnyx-2.7.0 lib/telnyx/phone_number.rb