Class: Twilio::REST::Webhooks::V1::AuthProfileList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Webhooks::V1::AuthProfileList
- Defined in:
- lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb
Defined Under Namespace
Classes: PatchAuthProfile, PostAuthProfile
Instance Method Summary collapse
-
#create(idempotency_key: :unset, post_auth_profile: nil) ⇒ AuthProfileInstance
Create the AuthProfileInstance.
-
#create_with_metadata(idempotency_key: :unset, post_auth_profile: nil) ⇒ AuthProfileInstance
Create the AuthProfileInstanceMetadata.
-
#each ⇒ Object
When passed a block, yields AuthProfileInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of AuthProfileInstance records from the API.
-
#initialize(version) ⇒ AuthProfileList
constructor
Initialize the AuthProfileList.
-
#list(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists AuthProfileInstance records from the API as a list.
-
#list_with_metadata(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Array of up to limit results.
-
#page(page_token: :unset, page_size: :unset) ⇒ Page
Page of AuthProfileInstance.
-
#stream(page_token: :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) ⇒ AuthProfileList
Initialize the AuthProfileList
134 135 136 137 138 139 140 141 142 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 134 def initialize(version) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { } @uri = "/Webhooks/AuthProfiles" end |
Instance Method Details
#create(idempotency_key: :unset, post_auth_profile: nil) ⇒ AuthProfileInstance
Create the AuthProfileInstance
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 148 def create( idempotency_key: :unset, post_auth_profile: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' payload = @version.create('POST', @uri, headers: headers, data: post_auth_profile.to_json) AuthProfileInstance.new( @version, payload, ) end |
#create_with_metadata(idempotency_key: :unset, post_auth_profile: nil) ⇒ AuthProfileInstance
Create the AuthProfileInstanceMetadata
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 171 def ( idempotency_key: :unset, post_auth_profile: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' response = @version.('POST', @uri, headers: headers, data: post_auth_profile.to_json) auth_profile_instance = AuthProfileInstance.new( @version, response.body, ) AuthProfileInstanceMetadata.new( @version, auth_profile_instance, response.headers, response.status_code ) end |
#each ⇒ Object
When passed a block, yields AuthProfileInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 270 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result.each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of AuthProfileInstance records from the API. Request is executed immediately.
309 310 311 312 313 314 315 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 309 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) AuthProfilePage.new(@version, response, @solution) end |
#list(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists AuthProfileInstance records from the API as a list.
Unlike stream(), this operation is eager and will load limit records into
memory before returning.
208 209 210 211 212 213 214 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 208 def list(page_token: :unset, limit: nil, page_size: nil) self.stream( page_token: page_token, limit: limit, page_size: page_size ).entries end |
#list_with_metadata(page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Returns Array of up to limit results.
252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 252 def (page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) params = Twilio::Values.of({ 'pageToken' => page_token, 'PageSize' => limits[:page_size], }); headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) AuthProfilePageMetadata.new(@version, response, @solution, limits[:limit]) end |
#page(page_token: :unset, page_size: :unset) ⇒ Page
Returns Page of AuthProfileInstance.
290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 290 def page(page_token: :unset, page_size: :unset) params = Twilio::Values.of({ 'pageToken' => page_token, 'PageSize' => page_size, }) headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) AuthProfilePage.new(@version, response, @solution) end |
#stream(page_token: :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.
228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 228 def stream(page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( page_token: page_token, page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result end |
#to_s ⇒ Object
Provide a user friendly representation
320 321 322 |
# File 'lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb', line 320 def to_s '#<Twilio.Webhooks.V1.AuthProfileList>' end |