Class: Consumer::Score
- Inherits:
-
Object
- Object
- Consumer::Score
- Defined in:
- lib/consumer_score_naj.rb
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#income ⇒ Object
Returns the value of attribute income.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query_hash) ⇒ Score
constructor
A new instance of Score.
Constructor Details
#initialize(query_hash) ⇒ Score
Returns a new instance of Score.
9 10 11 12 13 |
# File 'lib/consumer_score_naj.rb', line 9 def initialize(query_hash) @income = query_hash["income"] @zipcode = query_hash["zipcode"] @age = query_hash["age"] end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
7 8 9 |
# File 'lib/consumer_score_naj.rb', line 7 def age @age end |
#income ⇒ Object
Returns the value of attribute income.
7 8 9 |
# File 'lib/consumer_score_naj.rb', line 7 def income @income end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
7 8 9 |
# File 'lib/consumer_score_naj.rb', line 7 def zipcode @zipcode end |
Class Method Details
.convert_query_hash_to_string(query_hash) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/consumer_score_naj.rb', line 20 def self.convert_query_hash_to_string(query_hash) search_array = [] query_hash.each do |key, value| search_array << "#{key}=#{value}" end search_string = search_array.join("&") end |
.get_score(query_hash) ⇒ Object
15 16 17 18 |
# File 'lib/consumer_score_naj.rb', line 15 def self.get_score(query_hash) search_string = convert_query_hash_to_string(query_hash) response = Unirest.get("https://consumer-api-staging.herokuapp.com/customer_scoring.json?#{search_string}").body end |