Class: Twilio::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryContext::MobileList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryContext::MobileList
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb
Instance Method Summary collapse
-
#each ⇒ Object
When passed a block, yields MobileInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of MobileInstance records from the API.
-
#initialize(version, account_sid: nil, country_code: nil) ⇒ MobileList
constructor
Initialize the MobileList.
-
#list(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) ⇒ Array
Lists MobileInstance records from the API as a list.
-
#page(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of MobileInstance records from the API.
-
#stream(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, account_sid: nil, country_code: nil) ⇒ MobileList
Initialize the MobileList
28 29 30 31 32 33 34 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 28 def initialize(version, account_sid: nil, country_code: nil) super(version) # Path Solution @solution = { account_sid: account_sid, country_code: country_code } @uri = "/Accounts/#{@solution[:account_sid]}/AvailablePhoneNumbers/#{@solution[:country_code]}/Mobile.json" end |
Instance Method Details
#each ⇒ Object
When passed a block, yields MobileInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
150 151 152 153 154 155 156 157 158 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 150 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of MobileInstance records from the API. Request is executed immediately.
220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 220 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) MobilePage.new(@version, response, @solution) end |
#list(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) ⇒ Array
Lists MobileInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 65 def list(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) self.stream( area_code: area_code, contains: contains, sms_enabled: sms_enabled, mms_enabled: mms_enabled, voice_enabled: voice_enabled, exclude_all_address_required: exclude_all_address_required, exclude_local_address_required: exclude_local_address_required, exclude_foreign_address_required: exclude_foreign_address_required, beta: beta, near_number: near_number, near_lat_long: near_lat_long, distance: distance, in_postal_code: in_postal_code, in_region: in_region, in_rate_center: in_rate_center, in_lata: in_lata, in_locality: in_locality, fax_enabled: fax_enabled, limit: limit, page_size: page_size ).entries end |
#page(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of MobileInstance records from the API. Request is executed immediately.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 185 def page(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset) params = Twilio::Values.of({ 'AreaCode' => area_code, 'Contains' => contains, 'SmsEnabled' => sms_enabled, 'MmsEnabled' => mms_enabled, 'VoiceEnabled' => voice_enabled, 'ExcludeAllAddressRequired' => exclude_all_address_required, 'ExcludeLocalAddressRequired' => exclude_local_address_required, 'ExcludeForeignAddressRequired' => exclude_foreign_address_required, 'Beta' => beta, 'NearNumber' => near_number, 'NearLatLong' => near_lat_long, 'Distance' => distance, 'InPostalCode' => in_postal_code, 'InRegion' => in_region, 'InRateCenter' => in_rate_center, 'InLata' => in_lata, 'InLocality' => in_locality, 'FaxEnabled' => fax_enabled, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) MobilePage.new(@version, response, @solution) end |
#stream(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 119 def stream(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( area_code: area_code, contains: contains, sms_enabled: sms_enabled, mms_enabled: mms_enabled, voice_enabled: voice_enabled, exclude_all_address_required: exclude_all_address_required, exclude_local_address_required: exclude_local_address_required, exclude_foreign_address_required: exclude_foreign_address_required, beta: beta, near_number: near_number, near_lat_long: near_lat_long, distance: distance, in_postal_code: in_postal_code, in_region: in_region, in_rate_center: in_rate_center, in_lata: in_lata, in_locality: in_locality, fax_enabled: fax_enabled, page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end |
#to_s ⇒ Object
Provide a user friendly representation
231 232 233 |
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country/mobile.rb', line 231 def to_s '#<Twilio.Api.V2010.MobileList>' end |