lib/kentaa/api/resources/newsletter_subscription.rb in kentaa-api-0.6.0 vs lib/kentaa/api/resources/newsletter_subscription.rb in kentaa-api-0.7.0
- old
+ new
@@ -35,11 +35,11 @@
def last_name
data[:last_name]
end
def name
- [first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(" ")
+ [first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(' ')
end
def site_id
data[:site_id]
end
@@ -67,10 +67,26 @@
def subscription_url
data[:subscription_url]
end
def consent
+ Kentaa::Api::Deprecation.warn('#consent is deprecated. Please use #consents instead.', caller)
+
@consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent]
+ end
+
+ def consents
+ @consents ||= begin
+ consents = []
+
+ if data[:consents]
+ data[:consents].each do |consent|
+ consents << Kentaa::Api::Resources::Consent.new(consent)
+ end
+ end
+
+ consents
+ end
end
private
def load_resource