Class: Cb::Clients::Recommendations

Inherits:
Base
  • Object
show all
Defined in:
lib/cb/clients/recommendations.rb

Class Method Summary collapse

Methods inherited from Base

cb_client, headers

Class Method Details

.for_job(*args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cb/clients/recommendations.rb', line 17

def for_job(*args)
  hash_args = normalize_args(args)
  hash_args = hash_defaults(hash_args)
  json_hash = cb_client.cb_get(Cb.configuration.uri_recommendation_for_job,
                               query: hash_args)

  {
    jobs: create_jobs(json_hash, 'Job'),
    request: json_hash['ResponseRecommendJob']['Request'],
    recid: json_hash['ResponseRecommendJob']['Request']['RequestEvidenceID'],
    errors: json_hash['ResponseRecommendJob']['Errors']
  }
end

.for_user(*args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cb/clients/recommendations.rb', line 31

def for_user(*args)
  hash_args = normalize_args(args)
  hash_args = hash_defaults(hash_args)
  json_hash = cb_client.cb_get(Cb.configuration.uri_recommendation_for_user,
                               query: hash_args)

  {
    jobs: create_jobs(json_hash, 'User'),
    request: json_hash['ResponseRecommendUser']['Request'],
    recid: json_hash['ResponseRecommendUser']['Request']['RequestEvidenceID'],
    errors: json_hash['ResponseRecommendUser']['Errors']
  }
end