Class: Profile
- Inherits:
-
Object
- Object
- Profile
- Defined in:
- lib/profile.rb
Defined Under Namespace
Classes: Documents, Json, Parsing, Rating, Revealing, Scoring, Stage
Constant Summary collapse
- DEFAULT_DATE_START =
'1347209668'
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#parsing ⇒ Object
readonly
Returns the value of attribute parsing.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
-
#revealing ⇒ Object
readonly
Returns the value of attribute revealing.
-
#scoring ⇒ Object
readonly
Returns the value of attribute scoring.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
Instance Method Summary collapse
- #add(options) ⇒ Object
- #get(options) ⇒ Object
-
#initialize(clientw) ⇒ Profile
constructor
A new instance of Profile.
- #list(options) ⇒ Object
Constructor Details
#initialize(clientw) ⇒ Profile
Returns a new instance of Profile.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/profile.rb', line 15 def initialize(clientw) @clientw = clientw @document = Documents.new(@clientw) @parsing = Parsing.new(@clientw) @scoring = Scoring.new(@clientw) @json = Json.new(@clientw) @stage = Stage.new(@clientw) @rating = Rating.new(@clientw) @revealing = Revealing.new(@clientw) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'lib/profile.rb', line 6 def document @document end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
9 10 11 |
# File 'lib/profile.rb', line 9 def json @json end |
#parsing ⇒ Object (readonly)
Returns the value of attribute parsing.
7 8 9 |
# File 'lib/profile.rb', line 7 def parsing @parsing end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
11 12 13 |
# File 'lib/profile.rb', line 11 def @rating end |
#revealing ⇒ Object (readonly)
Returns the value of attribute revealing.
12 13 14 |
# File 'lib/profile.rb', line 12 def revealing @revealing end |
#scoring ⇒ Object (readonly)
Returns the value of attribute scoring.
8 9 10 |
# File 'lib/profile.rb', line 8 def scoring @scoring end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
10 11 12 |
# File 'lib/profile.rb', line 10 def stage @stage end |
Instance Method Details
#add(options) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/profile.rb', line 28 def add() if (!.key?('filepath')) raise RiminderArgumentException.new('A filepath should be given') end file_path = ['filepath'] payload = { 'source_id' => ['source_id'] } payload = ReqUtils.add_if_not_blank(payload, 'profile_reference', ['profile_reference']) payload = ReqUtils.add_if_not_blank(payload, 'timestamp_reception', ['timestamp_reception']) payload = ReqUtils.add_if_not_blank(payload, 'training_metadata', ReqUtils.validateTrainingMetadata(['training_metadata'])) resp = @clientw.postfile('profile', file_path, payload) return resp["data"] end |
#get(options) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/profile.rb', line 44 def get() query = { "source_id" => ['source_id'] } query = ReqUtils.add_if_not_blank(query, 'profile_id', ['profile_id']) query = ReqUtils.add_if_not_blank(query, 'profile_reference', ['profile_reference']) resp = @clientw.get("profile", query) return resp["data"] end |
#list(options) ⇒ Object
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 |
# File 'lib/profile.rb', line 54 def list() if (!['source_ids'].nil? && !['source_ids'].kind_of?(Array)) raise RiminderArgumentException.new('options should contains a the source_ids field a an Array') end query = { 'source_ids' => ['source_ids'].to_json, 'date_start' => DEFAULT_DATE_START, 'date_end' => Time.now.to_i, 'page' => 1, 'sort_by' => 'ranking' } query = ReqUtils.add_if_not_blank(query, 'seniority', ['seniority']) query = ReqUtils.add_if_not_blank(query, 'filter_id', ['filter_id']) query = ReqUtils.add_if_not_blank(query, 'filter_reference', ['filter_reference']) query = ReqUtils.add_if_not_blank(query, 'stage', ['stage']) query = ReqUtils.add_if_not_blank(query, 'rating', ['rating']) query = ReqUtils.add_if_not_blank(query, 'date_start', ['date_start']) query = ReqUtils.add_if_not_blank(query, 'date_end', ['date_end']) query = ReqUtils.add_if_not_blank(query, 'page', ['page']) query = ReqUtils.add_if_not_blank(query, 'limit', ['limit']) query = ReqUtils.add_if_not_blank(query, 'sort_by', ['sort_by']) query = ReqUtils.add_if_not_blank(query, 'order_by', ['order_by']) resp = @clientw.get('profiles', query) return resp["data"] end |