Class: Trustev::Profile
- Inherits:
-
Object
- Object
- Trustev::Profile
- Defined in:
- lib/trustev/profile.rb
Constant Summary collapse
- SERVICE_URL =
'ProfileService.svc/rest/Transaction'
Instance Method Summary collapse
- #get_overall_score ⇒ Object
- #get_score(source_id, parameter_id) ⇒ Object
-
#initialize(transaction_number) ⇒ Profile
constructor
A new instance of Profile.
- #retrieve_scores ⇒ Object
Constructor Details
Instance Method Details
#get_overall_score ⇒ Object
15 16 17 |
# File 'lib/trustev/profile.rb', line 15 def get_overall_score get_score(Trustev::SCORE_SOURCES[:trustev], Trustev::SCORE_PARAMETERS[:overall]) end |
#get_score(source_id, parameter_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trustev/profile.rb', line 19 def get_score(source_id, parameter_id) raise Error.new('Invalid Source') if Trustev::SCORE_SOURCES.key(source_id).nil? raise Error.new('Invalid Parameter') if Trustev::SCORE_PARAMETERS.key(parameter_id).nil? response = retrieve_scores response[:Profile][:Sources].each do | source | if source[:Source] == source_id source[:Scores].each { | score | return score[:Score] if score[:Parameter] == parameter_id } end end end |
#retrieve_scores ⇒ Object
11 12 13 |
# File 'lib/trustev/profile.rb', line 11 def retrieve_scores Trustev.send_request "#{SERVICE_URL}/#{@transaction_number}", [], 'GET', true end |