Class: Akatus::Payer
- Inherits:
-
Object
- Object
- Akatus::Payer
- Includes:
- Transferrable
- Defined in:
- lib/akatus/payer.rb
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#phones ⇒ Object
Returns the value of attribute phones.
Instance Method Summary collapse
- #address ⇒ Object
- #address=(val) ⇒ Object
- #phone ⇒ Object
- #phone=(val) ⇒ Object
- #to_payload(include_root = true) ⇒ Object
Methods included from Transferrable
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses.
6 7 8 |
# File 'lib/akatus/payer.rb', line 6 def addresses @addresses end |
#phones ⇒ Object
Returns the value of attribute phones.
6 7 8 |
# File 'lib/akatus/payer.rb', line 6 def phones @phones end |
Instance Method Details
#address ⇒ Object
12 13 14 |
# File 'lib/akatus/payer.rb', line 12 def address addresses[0] if addresses end |
#address=(val) ⇒ Object
8 9 10 |
# File 'lib/akatus/payer.rb', line 8 def address=(val) addresses ? addresses.unshift(val) : (@addresses = [val]) end |
#phone ⇒ Object
20 21 22 |
# File 'lib/akatus/payer.rb', line 20 def phone phones[0] if phones end |
#phone=(val) ⇒ Object
16 17 18 |
# File 'lib/akatus/payer.rb', line 16 def phone=(val) phones ? phones.unshift(val) : (@phones = [val]) end |
#to_payload(include_root = true) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/akatus/payer.rb', line 24 def to_payload(include_root = true) payload = super(true) # Tweak Akatus' weird array format. payload['pagador']['enderecos'] = { 'endereco' => addresses.map { |a| a.to_payload(false) } } payload['pagador']['telefones'] = { 'telefone' => phones.map { |p| p.to_payload(false) } } include_root ? payload : payload.values.first end |