Sha256: 67a3827821e3cbecd3882a1eb28783f32a32447524cdec06725f12b2c935793d

Contents?: true

Size: 721 Bytes

Versions: 22

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module Telnyx
  class SingletonAPIResource < APIResource
    def self.resource_url
      if self == SingletonAPIResource
        raise NotImplementedError, "SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Account, etc.)"
      end
      # Namespaces are separated in object names with periods (.) and in URLs
      # with forward slashes (/), so replace the former with the latter.
      "/v2/#{self::OBJECT_NAME.downcase.tr('.', '/')}"
    end

    def resource_url
      self.class.resource_url
    end

    def self.retrieve(opts = {})
      instance = new(nil, Util.normalize_opts(opts))
      instance.refresh
      instance
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
telnyx-3.0.5 lib/telnyx/singleton_api_resource.rb
telnyx-3.0.4 lib/telnyx/singleton_api_resource.rb
telnyx-3.0.3 lib/telnyx/singleton_api_resource.rb
telnyx-3.0.2 lib/telnyx/singleton_api_resource.rb
telnyx-3.0.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.9.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.8.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.7.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.6.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.5.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.4.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.3.0 lib/telnyx/singleton_api_resource.rb
telnyx-2.2.0 lib/telnyx/singleton_api_resource.rb
telnyx-0.1.0 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.8 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.7 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.6 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.5 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.4 lib/telnyx/singleton_api_resource.rb
telnyx-0.0.3 lib/telnyx/singleton_api_resource.rb