Module: Consumer::Build

Defined in:
lib/consumer/consumer.rb

Instance Method Summary collapse

Instance Method Details

#build(category, position_update_interval: nil, poll_interval_milliseconds: nil, identifier: nil, supplemental_settings: nil, **arguments) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/consumer/consumer.rb', line 178

def build(category, position_update_interval: nil, poll_interval_milliseconds: nil, identifier: nil, supplemental_settings: nil, **arguments)
  instance = new(category)

  if not identifier.nil?
    instance.identifier = identifier
  end

  if not supplemental_settings.nil?
    if not supplemental_settings.is_a?(::Settings)
      supplemental_settings = ::Settings.build(supplemental_settings)
    end

    instance.supplemental_settings = supplemental_settings
  end

  instance.position_update_interval = position_update_interval
  instance.poll_interval_milliseconds = poll_interval_milliseconds

  instance.configure(**arguments)

  instance
end