Class: SurveyMonkey::Recipient

Inherits:
Object
  • Object
show all
Defined in:
lib/survey_monkey/recipient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Recipient

Returns a new instance of Recipient.



5
6
7
8
9
10
11
# File 'lib/survey_monkey/recipient.rb', line 5

def initialize(options = {})
  @email = options[:email]
  @first_name = options[:first_name]
  @last_name = options[:last_name]
  @custom_id = options[:custom_id]
  raise "Email Required for Recipient" if email.nil?
end

Instance Attribute Details

#custom_idObject

Returns the value of attribute custom_id.



3
4
5
# File 'lib/survey_monkey/recipient.rb', line 3

def custom_id
  @custom_id
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/survey_monkey/recipient.rb', line 3

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/survey_monkey/recipient.rb', line 3

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/survey_monkey/recipient.rb', line 3

def last_name
  @last_name
end

Instance Method Details

#to_hashObject



13
14
15
16
17
18
19
20
# File 'lib/survey_monkey/recipient.rb', line 13

def to_hash
  hash = Hash.new
  hash["email"] = email unless email.nil?
  hash["first_name"] = first_name unless first_name.nil?
  hash["last_name"] = last_name unless last_name.nil?
  hash["custom_id"] = custom_id unless custom_id.nil?
  hash
end