Class: PaysonAPI::Sender
- Inherits:
-
Object
- Object
- PaysonAPI::Sender
- Defined in:
- lib/payson_api/sender.rb
Constant Summary collapse
- FORMAT_STRING =
"sender%s"
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(email, first_name, last_name) ⇒ Sender
constructor
A new instance of Sender.
- #to_hash ⇒ Object
Constructor Details
#initialize(email, first_name, last_name) ⇒ Sender
Returns a new instance of Sender.
8 9 10 11 12 |
# File 'lib/payson_api/sender.rb', line 8 def initialize(email, first_name, last_name) @email = email @first_name = first_name @last_name = last_name end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/payson_api/sender.rb', line 6 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
6 7 8 |
# File 'lib/payson_api/sender.rb', line 6 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
6 7 8 |
# File 'lib/payson_api/sender.rb', line 6 def last_name @last_name end |
Class Method Details
.parse(data) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/payson_api/sender.rb', line 22 def self.parse(data) email = data[FORMAT_STRING % 'email'] first_name = CGI.unescape(data[FORMAT_STRING % 'FirstName'].to_s) last_name = CGI.unescape(data[FORMAT_STRING % 'LastName'].to_s) self.new(email, first_name, last_name) end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/payson_api/sender.rb', line 14 def to_hash {}.tap do |hash| hash[FORMAT_STRING % 'Email'] = @email hash[FORMAT_STRING % 'FirstName'] = @first_name hash[FORMAT_STRING % 'LastName'] = @last_name end end |