Module: ContactAttribute::CustomKeys
- Included in:
- ContactAttribute
- Defined in:
- app/models/contact_attribute/custom_keys.rb
Instance Method Summary collapse
-
#async_custom_keys(options = {}) ⇒ Object
Get CustomAttribute names.
-
#custom_keys(options = {}) ⇒ Object
Get CustomAttribute names.
Instance Method Details
#async_custom_keys(options = {}) ⇒ Object
Get CustomAttribute names
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/contact_attribute/custom_keys.rb', line 10 def async_custom_keys(={}) = self.merge_key() request = Typhoeus::Request.new("#{resource_uri}/custom_keys", params: ) request.on_complete do |response| if response.code >= 200 && response.code < 400 log_ok(response) parsed_response = ActiveSupport::JSON.decode(response.body) yield parsed_response['collection'] else log_failed(response) end end self.hydra.queue(request) end |
#custom_keys(options = {}) ⇒ Object
Get CustomAttribute names
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/contact_attribute/custom_keys.rb', line 30 def custom_keys(={}) result = nil self.retries.times do begin async_custom_keys(){|i| result = i} Timeout::timeout(self.timeout/1000) do self.hydra.run end break unless result.nil? rescue Timeout::Error self.logger.warn("timeout") result = nil end end result end |