Class: SupplejackApi::InteractionUpdaters::UsageMetrics
- Inherits:
-
Object
- Object
- SupplejackApi::InteractionUpdaters::UsageMetrics
- Defined in:
- app/models/supplejack_api/interaction_updaters/usage_metrics.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize ⇒ UsageMetrics
constructor
A new instance of UsageMetrics.
- #process(record_interactions) ⇒ Object
Constructor Details
#initialize ⇒ UsageMetrics
Returns a new instance of UsageMetrics.
7 8 9 |
# File 'app/models/supplejack_api/interaction_updaters/usage_metrics.rb', line 7 def initialize @model = SupplejackApi::InteractionModels::Record end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'app/models/supplejack_api/interaction_updaters/usage_metrics.rb', line 5 def model @model end |
Instance Method Details
#process(record_interactions) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/supplejack_api/interaction_updaters/usage_metrics.rb', line 11 def process(record_interactions) search_counts = build_hash_for(record_interactions, 'search') get_counts = build_hash_for(record_interactions, 'get') user_set_counts = build_hash_for(record_interactions, 'user_set') unique_facets = (search_counts.keys + get_counts.keys + user_set_counts.keys).uniq # Creating metrics for each primary collection unique_facets.each do |facet| process_facet(facet, search_counts, get_counts, user_set_counts) end true end |