Class: Telnyx::SingletonAPIResource

Inherits:
APIResource show all
Defined in:
lib/telnyx/singleton_api_resource.rb

Direct Known Subclasses

PublicKey

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

class_name, identified_resource_url, inherited, #refresh, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from TelnyxObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Telnyx::TelnyxObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Telnyx::TelnyxObject

Class Method Details

.resource_urlObject



5
6
7
8
9
10
11
12
# File 'lib/telnyx/singleton_api_resource.rb', line 5

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

.retrieve(opts = {}) ⇒ Object



18
19
20
21
22
# File 'lib/telnyx/singleton_api_resource.rb', line 18

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

Instance Method Details

#resource_urlObject



14
15
16
# File 'lib/telnyx/singleton_api_resource.rb', line 14

def resource_url
  self.class.resource_url
end