Sha256: 15efeb6682d6e23f562150d0d7ff6ecadc1463e542307e2dc6cf44e078e92db3
Contents?: true
Size: 645 Bytes
Versions: 1
Compression:
Stored size: 645 Bytes
Contents
module MonkeyParty class Subscriber attr_accessor :email, :merge_fields, :error def initialize(email, merge_fields = {}) self.email = email self.merge_fields = merge_fields self.error = nil end def to_h { :email => self.email, }.merge(self.merge_fields).tap do |h| h[:error] = self.error.to_h if self.error end end def to_mailchimp_hash self.to_h.keys.inject({}) do |chimp_hash, key| chimp_hash[key.to_s.upcase[0..9]] = self.to_h[key] unless key == :error chimp_hash end end def valid? self.error.nil? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
monkey_party-0.3.2 | lib/monkey_party/subscriber.rb |