Class: PaysonAPI::V1::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/v1/sender.rb

Constant Summary collapse

FORMAT_STRING =
'sender%s'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email.



9
10
11
# File 'lib/payson_api/v1/sender.rb', line 9

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



9
10
11
# File 'lib/payson_api/v1/sender.rb', line 9

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



9
10
11
# File 'lib/payson_api/v1/sender.rb', line 9

def last_name
  @last_name
end

Class Method Details

.parse(data) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/payson_api/v1/sender.rb', line 19

def self.parse(data)
  new.tap do |s|
    s.email = data[FORMAT_STRING % 'email']
    s.first_name = CGI.unescape(data[FORMAT_STRING % 'FirstName'].to_s)
    s.last_name = CGI.unescape(data[FORMAT_STRING % 'LastName'].to_s)
  end
end

Instance Method Details

#to_hashObject



11
12
13
14
15
16
17
# File 'lib/payson_api/v1/sender.rb', line 11

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