Class: MyMoip::Payer

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/mymoip/payer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Payer

Returns a new instance of Payer.



20
21
22
23
24
# File 'lib/mymoip/payer.rb', line 20

def initialize(attrs)
  attrs.each do |attr, value|
    public_send(:"#{attr}=", value)
  end
end

Instance Attribute Details

#address_cepObject

Returns the value of attribute address_cep.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_cep
  @address_cep
end

#address_cityObject

Returns the value of attribute address_city.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_city
  @address_city
end

#address_countryObject

Returns the value of attribute address_country.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_country
  @address_country
end

#address_neighbourhoodObject

Returns the value of attribute address_neighbourhood.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_neighbourhood
  @address_neighbourhood
end

#address_phoneObject

Returns the value of attribute address_phone.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_phone
  @address_phone
end

#address_stateObject

Returns the value of attribute address_state.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_state
  @address_state
end

#address_streetObject

Returns the value of attribute address_street.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_street
  @address_street
end

#address_street_extraObject

Returns the value of attribute address_street_extra.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_street_extra
  @address_street_extra
end

#address_street_numberObject

Returns the value of attribute address_street_number.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def address_street_number
  @address_street_number
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def email
  @email
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/mymoip/payer.rb', line 5

def name
  @name
end

Instance Method Details

#to_xml(root = nil, formatter = MyMoip::Formatter) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mymoip/payer.rb', line 51

def to_xml(root = nil, formatter = MyMoip::Formatter)
  if root.nil?
    xml  = ""
    root ||= Builder::XmlMarkup.new(target: xml)
  end

  root.Nome(@name)
  root.Email(@email)
  root.IdPagador(@id)
  root.EnderecoCobranca do |n1|
    n1.Logradouro(@address_street)
    n1.Numero(@address_street_number)
    n1.Complemento(@address_street_extra)
    n1.Bairro(@address_neighbourhood)
    n1.Cidade(@address_city)
    n1.Estado(@address_state)
    n1.Pais(@address_country)
    n1.CEP(formatter.cep(@address_cep))
    n1.TelefoneFixo(formatter.phone(@address_phone))
  end

  xml
end