Class: SignalWire::REST::Namespaces::CompatPhoneNumbers

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/signalwire/rest/namespaces/compat.rb

Overview

Compat phone number management.

Instance Method Summary collapse

Constructor Details

#initialize(http, base) ⇒ CompatPhoneNumbers

Returns a new instance of CompatPhoneNumbers.



127
128
129
130
# File 'lib/signalwire/rest/namespaces/compat.rb', line 127

def initialize(http, base)
  super(http, base)
  @available_base = base.sub('/IncomingPhoneNumbers', '/AvailablePhoneNumbers')
end

Instance Method Details

#delete(sid) ⇒ Object



136
# File 'lib/signalwire/rest/namespaces/compat.rb', line 136

def delete(sid) = @http.delete(_path(sid))

#get(sid) ⇒ Object



134
# File 'lib/signalwire/rest/namespaces/compat.rb', line 134

def get(sid) = @http.get(_path(sid))

#import_number(**kwargs) ⇒ Object



138
139
140
141
# File 'lib/signalwire/rest/namespaces/compat.rb', line 138

def import_number(**kwargs)
  path = @base_path.sub('/IncomingPhoneNumbers', '/ImportedPhoneNumbers')
  @http.post(path, kwargs)
end

#list(**params) ⇒ Object



132
# File 'lib/signalwire/rest/namespaces/compat.rb', line 132

def list(**params) = @http.get(@base_path, params.empty? ? nil : params)

#list_available_countries(**params) ⇒ Object



143
144
145
# File 'lib/signalwire/rest/namespaces/compat.rb', line 143

def list_available_countries(**params)
  @http.get(@available_base, params.empty? ? nil : params)
end

#purchase(**kwargs) ⇒ Object



133
# File 'lib/signalwire/rest/namespaces/compat.rb', line 133

def purchase(**kwargs) = @http.post(@base_path, kwargs)

#search_local(country, **params) ⇒ Object



147
148
149
# File 'lib/signalwire/rest/namespaces/compat.rb', line 147

def search_local(country, **params)
  @http.get("#{@available_base}/#{country}/Local", params.empty? ? nil : params)
end

#search_toll_free(country, **params) ⇒ Object



151
152
153
# File 'lib/signalwire/rest/namespaces/compat.rb', line 151

def search_toll_free(country, **params)
  @http.get("#{@available_base}/#{country}/TollFree", params.empty? ? nil : params)
end

#update(sid, **kwargs) ⇒ Object



135
# File 'lib/signalwire/rest/namespaces/compat.rb', line 135

def update(sid, **kwargs) = @http.post(_path(sid), kwargs)