Class: Reach::REST::Api::Authentix::ConfigurationItemList
- Inherits:
-
ListResource
- Object
- ListResource
- Reach::REST::Api::Authentix::ConfigurationItemList
- Defined in:
- lib/reach-ruby/rest/api/authentix/configuration_item.rb
Instance Method Summary collapse
-
#create(service_name: nil, code_length: :unset, allow_custom_code: :unset, used_for_digital_payment: :unset, default_expiry_time: :unset, default_max_trials: :unset, default_max_controls: :unset, smtp_setting_id: :unset, email_template_id: :unset, sms_template_id: :unset) ⇒ ConfigurationItemInstance
Create the ConfigurationItemInstance.
-
#each ⇒ Object
When passed a block, yields ConfigurationItemInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of ConfigurationItemInstance records from the API.
-
#initialize(version) ⇒ ConfigurationItemList
constructor
Initialize the ConfigurationItemList.
-
#list(limit: nil, page_size: nil) ⇒ Array
Lists ConfigurationItemInstance records from the API as a list.
-
#page(page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of ConfigurationItemInstance records from the API.
-
#stream(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) ⇒ ConfigurationItemList
Initialize the ConfigurationItemList
26 27 28 29 30 31 32 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 26 def initialize(version) super(version) # Path Solution @solution = { } @uri = "/authentix/v1/configurations" end |
Instance Method Details
#create(service_name: nil, code_length: :unset, allow_custom_code: :unset, used_for_digital_payment: :unset, default_expiry_time: :unset, default_max_trials: :unset, default_max_controls: :unset, smtp_setting_id: :unset, email_template_id: :unset, sms_template_id: :unset) ⇒ ConfigurationItemInstance
Create the ConfigurationItemInstance
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 46 def create( service_name: nil, code_length: :unset, allow_custom_code: :unset, used_for_digital_payment: :unset, default_expiry_time: :unset, default_max_trials: :unset, default_max_controls: :unset, smtp_setting_id: :unset, email_template_id: :unset, sms_template_id: :unset ) baseParams = { } data = Reach::Values.of(baseParams.merge({ 'serviceName' => service_name, 'codeLength' => code_length, 'allowCustomCode' => allow_custom_code, 'usedForDigitalPayment' => used_for_digital_payment, 'defaultExpiryTime' => default_expiry_time, 'defaultMaxTrials' => default_max_trials, 'defaultMaxControls' => default_max_controls, 'smtpSettingId' => smtp_setting_id, 'emailTemplateId' => email_template_id, 'smsTemplateId' => sms_template_id, })) payload = @version.create('POST', @uri, data: data) ConfigurationItemInstance.new( @version, payload, ) end |
#each ⇒ Object
When passed a block, yields ConfigurationItemInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
126 127 128 129 130 131 132 133 134 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 126 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 ConfigurationItemInstance records from the API. Request is executed immediately.
160 161 162 163 164 165 166 167 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 160 def get_page(target_url) baseUrl = @version.url_without_pagination_info(target_url) response = @version.domain.request( 'GET', target_url ) ConfigurationItemPage.new(baseUrl, @version, response, @solution) end |
#list(limit: nil, page_size: nil) ⇒ Array
Lists ConfigurationItemInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.
95 96 97 98 99 100 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 95 def list(limit: nil, page_size: nil) self.stream( limit: limit, page_size: page_size ).entries end |
#page(page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of ConfigurationItemInstance records from the API. Request is executed immediately.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 142 def page(page_token: :unset, page_number: :unset, page_size: :unset) params = Reach::Values.of({ 'page' => page_number, 'pageSize' => page_size, }) baseUrl = @version.url_without_pagination_info(@version.absolute_url(@uri), params) response = @version.page('GET', @uri, params: params) ConfigurationItemPage.new(baseUrl, @version, response, @solution) end |
#stream(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.
113 114 115 116 117 118 119 120 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 113 def stream(limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( 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
172 173 174 |
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 172 def to_s '#<Reach.Api.Authentix.ConfigurationItemList>' end |