Class: Posthubify::NumbersResource

Inherits:
Object
  • Object
show all
Defined in:
lib/posthubify/resources/telecom.rb

Overview

Phone number provisioning (Node sdk .numbers).

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ NumbersResource

Returns a new instance of NumbersResource.



6
7
8
# File 'lib/posthubify/resources/telecom.rb', line 6

def initialize(http)
  @http = http
end

Instance Method Details

#buy(input) ⇒ Object

Buy a new number ({ ‘country’ => …, ‘profileId’ => … }).



21
22
23
# File 'lib/posthubify/resources/telecom.rb', line 21

def buy(input)
  @http.data('POST', '/numbers', body: input)
end

#countriesObject

List countries where a number can be purchased.



11
12
13
# File 'lib/posthubify/resources/telecom.rb', line 11

def countries
  @http.data('GET', '/numbers/countries')
end

#listObject

List the numbers on the account.



16
17
18
# File 'lib/posthubify/resources/telecom.rb', line 16

def list
  @http.data('GET', '/numbers')
end

#release(id) ⇒ Object

Release the number (cancel it).



26
27
28
# File 'lib/posthubify/resources/telecom.rb', line 26

def release(id)
  @http.data('DELETE', "/numbers/#{id}")
end