Class: SurgeAPI::Resources::PhoneNumbers
- Inherits:
-
Object
- Object
- SurgeAPI::Resources::PhoneNumbers
- Defined in:
- lib/surge_api/resources/phone_numbers.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ PhoneNumbers
constructor
private
A new instance of PhoneNumbers.
-
#list(account_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::PhoneNumber>
Some parameter documentations has been truncated, see Models::PhoneNumberListParams for more details.
-
#purchase(account_id, area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {}) ⇒ SurgeAPI::Models::PhoneNumber
Some parameter documentations has been truncated, see Models::PhoneNumberPurchaseParams for more details.
Constructor Details
#initialize(client:) ⇒ PhoneNumbers
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PhoneNumbers.
73 74 75 |
# File 'lib/surge_api/resources/phone_numbers.rb', line 73 def initialize(client:) @client = client end |
Instance Method Details
#list(account_id, after: nil, before: nil, request_options: {}) ⇒ SurgeAPI::Internal::Cursor<SurgeAPI::Models::PhoneNumber>
Some parameter documentations has been truncated, see Models::PhoneNumberListParams for more details.
List all phone numbers for an account with cursor-based pagination.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/surge_api/resources/phone_numbers.rb', line 24 def list(account_id, params = {}) parsed, = SurgeAPI::PhoneNumberListParams.dump_request(params) @client.request( method: :get, path: ["accounts/%1$s/phone_numbers", account_id], query: parsed, page: SurgeAPI::Internal::Cursor, model: SurgeAPI::PhoneNumber, options: ) end |
#purchase(account_id, area_code: nil, latitude: nil, longitude: nil, type: nil, request_options: {}) ⇒ SurgeAPI::Models::PhoneNumber
Some parameter documentations has been truncated, see Models::PhoneNumberPurchaseParams for more details.
Purchase a new phone number for the account. You can specify search criteria or let the system select a random number.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/surge_api/resources/phone_numbers.rb', line 59 def purchase(account_id, params = {}) parsed, = SurgeAPI::PhoneNumberPurchaseParams.dump_request(params) @client.request( method: :post, path: ["accounts/%1$s/phone_numbers", account_id], body: parsed, model: SurgeAPI::PhoneNumber, options: ) end |