Sha256: 118669f3cefd57da9cd4fd5f0d714db9fa27c412c0bff36ab41ae6d4d657583c

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 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)
    end

    def to_mailchimp_hash
      chimp_hash = {}
      self.to_h.each do |key, value|
        chimp_hash[key.to_s.upcase] = value
      end

      chimp_hash
    end

    def valid?
      self.error.nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dpickett-monkey_party-0.0.1 lib/monkey_party/subscriber.rb
dpickett-monkey_party-0.0.3 lib/monkey_party/subscriber.rb