Class: Sepa::DirectDebitOrder::Party

Inherits:
Object
  • Object
show all
Defined in:
lib/sepa/direct_debit_order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email) ⇒ Party

Returns a new instance of Party.



38
39
40
41
# File 'lib/sepa/direct_debit_order.rb', line 38

def initialize name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email
  @name, @address_line_1, @address_line_2, @postcode, @town, @country = name, address_line_1, address_line_2, postcode, town, country
  @contact_name, @contact_phone, @contact_email = contact_name, contact_phone, contact_email
end

Instance Attribute Details

#address_line_1Object

Returns the value of attribute address_line_1.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def address_line_1
  @address_line_1
end

#address_line_2Object

Returns the value of attribute address_line_2.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def address_line_2
  @address_line_2
end

#contact_emailObject

Returns the value of attribute contact_email.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def contact_email
  @contact_email
end

#contact_nameObject

Returns the value of attribute contact_name.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def contact_name
  @contact_name
end

#contact_phoneObject

Returns the value of attribute contact_phone.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def contact_phone
  @contact_phone
end

#countryObject

Returns the value of attribute country.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def country
  @country
end

#nameObject

Returns the value of attribute name.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def name
  @name
end

#postcodeObject

Returns the value of attribute postcode.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def postcode
  @postcode
end

#townObject

Returns the value of attribute town.



36
37
38
# File 'lib/sepa/direct_debit_order.rb', line 36

def town
  @town
end

Instance Method Details

#to_properties(prefix) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/sepa/direct_debit_order.rb', line 43

def to_properties prefix
  hsh = {
    "#{prefix}.name"                                              => name,
    "#{prefix}.postal_address.address_line[0]"                    => address_line_1,
    "#{prefix}.postal_address.post_code"                          => postcode,
    "#{prefix}.postal_address.town_name"                          => town,
    "#{prefix}.postal_address.country"                            => country,
    "#{prefix}.contact_details.name"                              => contact_name,
    "#{prefix}.contact_details.phone_number"                      => contact_phone,
    "#{prefix}.contact_details.email_address"                     => contact_email,
  }

  hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 if address_line_2

  hsh
end