class PromotionEvaluationService
Public Instance Methods
evaluate(promotion_id, token, attributes, demographic_data)
click to toggle source
# File lib/promotion_evaluation_service.rb, line 6 def evaluate(promotion_id, token, attributes, demographic_data) response = RestClient::Request.new({ method: :post, url: url(promotion_id), payload: { attributes: attributes, demographic_data: demographic_data, token: token }, headers: { content_type: :json }, timeout: 1, open_timeout: 1 }).execute do |response, request, result| case response.code when 200 puts JSON.parse(response.body) else puts "No aplica" end end end
Private Instance Methods
url(promotion_id)
click to toggle source
# File lib/promotion_evaluation_service.rb, line 26 def url(promotion_id) "https://couponsv2-promotions.azurewebsites.net/promotions" + promotion_id + "/evaluate" end