Sha256: 33e2578ecd1956fc1ad5909e8adc90a85a1bea1e5217bb76350c814afdf70bed
Contents?: true
Size: 734 Bytes
Versions: 3
Compression:
Stored size: 734 Bytes
Contents
require "consumer_score_naj/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.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 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
consumer_score_naj-0.6.0 | lib/consumer_score_naj.rb |
consumer_score_naj-0.5.0 | lib/consumer_score_naj.rb |
consumer_score_naj-0.4.0 | lib/consumer_score_naj.rb |