lib/promoter/contact.rb in promoter-0.2.0 vs lib/promoter/contact.rb in promoter-0.9.0

- old
+ new

@@ -84,11 +84,17 @@ response = Request.post(API_URL + "/", params) new(response) end def self.survey(params) - response = Request.post(API_URL + "/survey/", params) - new(response) + contact_attributes = if Promoter.api_version == 2 + api_url = "https://app.promoter.io/api/v2" + response = Request.post(api_url + "/survey/", params) + response["contact"] + else + Request.post(API_URL + "/survey/", params) + end + new(contact_attributes) end # used for ensuring the values of the attributes hashes are strings def self.values_to_string(hash) hash.each{ |key, value| hash[key] = value.to_s }