Class: GiftRocket::Recipient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Recipient

Returns a new instance of Recipient.



8
9
10
11
12
13
14
15
# File 'lib/gift_rocket/recipient.rb', line 8

def initialize(options)
  @name   = options[:name]
  @email  = options[:email]

  raise GiftRocket::Error::MissingRecipientEmail.new('Recipient email not specified') if @email.nil? || @email.empty?
  raise GiftRocket::Error::MissingRecipientName.new('Recipient name not specified') if @name.nil? || @name.empty?

end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#paramsObject



17
18
19
# File 'lib/gift_rocket/recipient.rb', line 17

def params
  {'gift[recipient_email]' => @email, 'gift[recipient_name]' => @name}
end