Class: VoiceTel::Resources::INumbering

Inherits:
Base
  • Object
show all
Defined in:
lib/voicetel/resources/i_numbering.rb

Overview

INumberingService — inventory searches, orders, and port-ins.

PortAvailability returns the v2.2.10 fields ‘local_routing_number` and `rate_center_tier` alongside `number`, `portable`, `losing_carrier`, `reason`.

Instance Method Summary collapse

Methods inherited from Base

#compact_query, #initialize

Constructor Details

This class inherits a constructor from VoiceTel::Resources::Base

Instance Method Details

#coverage(state: nil, ratecenter: nil) ⇒ Object

GET /v2.2/inventory/coverage — aggregated availability buckets.



22
23
24
25
# File 'lib/voicetel/resources/i_numbering.rb', line 22

def coverage(state: nil, ratecenter: nil)
  q = compact_query("state" => state, "ratecenter" => ratecenter)
  @transport.request(:get, "/v2.2/inventory/coverage", query: q)
end

#order(body) ⇒ Object

POST /v2.2/orders — purchase new TNs.



28
29
30
# File 'lib/voicetel/resources/i_numbering.rb', line 28

def order(body)
  @transport.request(:post, "/v2.2/orders", body: body)
end

#port(id) ⇒ Object

GET /v2.2/ports/id — detail for one port-in.



38
39
40
# File 'lib/voicetel/resources/i_numbering.rb', line 38

def port(id)
  @transport.request(:get, "/v2.2/ports/#{id}")
end

#port_availability(number) ⇒ Object

GET /v2.2/ports/availability/number — check whether a TN can be ported in.



48
49
50
# File 'lib/voicetel/resources/i_numbering.rb', line 48

def port_availability(number)
  @transport.request(:get, "/v2.2/ports/availability/#{number}")
end

#portsObject

GET /v2.2/ports — list every port-in record.



33
34
35
# File 'lib/voicetel/resources/i_numbering.rb', line 33

def ports
  @transport.request(:get, "/v2.2/ports")
end

#search_inventory(npa: nil, nxx: nil, state: nil, ratecenter: nil, contains: nil, endswith: nil, limit: nil) ⇒ Object

GET /v2.2/inventory — search available TNs.



13
14
15
16
17
18
19
# File 'lib/voicetel/resources/i_numbering.rb', line 13

def search_inventory(npa: nil, nxx: nil, state: nil, ratecenter: nil, contains: nil, endswith: nil, limit: nil)
  q = compact_query(
    "npa" => npa, "nxx" => nxx, "state" => state, "ratecenter" => ratecenter,
    "contains" => contains, "endswith" => endswith, "limit" => limit
  )
  @transport.request(:get, "/v2.2/inventory", query: q)
end

#submit_port(body) ⇒ Object

POST /v2.2/ports — submit a port-in.



43
44
45
# File 'lib/voicetel/resources/i_numbering.rb', line 43

def submit_port(body)
  @transport.request(:post, "/v2.2/ports", body: body)
end