Sha256: 6e4338ee5a8a132905f8f5df55e8f8068b1c3d9986131a8c564ad2a42bd4f7ce
Contents?: true
Size: 705 Bytes
Versions: 1
Compression:
Stored size: 705 Bytes
Contents
require "consumer_score/version" require "unirest" module Consumer class Score attr_accessor :income, :zipcode, :age def initialize(query_hash) @income = query_hash["income"] @zipcode = query_hash["zipcode"] @age = query_hash["age"] end def self.where(query_hash) search_string = convert_query_hash_to_string(query_hash) response = Unirest.get("http://localhost:3000/customer_scoring.json?#{search_string}").body end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
consumer_score_naj-0.1.0 | lib/consumer_score.rb |