Class: MercuryBanking::Recipient

Inherits:
Object
  • Object
show all
Defined in:
lib/mercury_banking/recipient.rb

Overview

Recipient class for Mercury Banking API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, email:, account_number:, routing_number:, address:, city:, region:, postal_code:, country:) ⇒ Recipient

Returns a new instance of Recipient.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mercury_banking/recipient.rb', line 8

def initialize(name:, email:, account_number:, routing_number:, address:, city:, region:, postal_code:, country:)
  @name = name
  @address = {
    name: name,
    address1: address,
    city: city,
    region: region,
    postalCode: postal_code,
    country: country
  }
  @emails = [email]
  @payment_method = "electronic"
  @electronic_routing_info = {
    accountNumber: ,
    routingNumber: routing_number,
    electronicAccountType: "businessChecking",
    address: @address
  }
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def address
  @address
end

#cityObject

Returns the value of attribute city.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def city
  @city
end

#countryObject

Returns the value of attribute country.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def country
  @country
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def email
  @email
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def name
  @name
end

#postal_codeObject

Returns the value of attribute postal_code.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def postal_code
  @postal_code
end

#regionObject

Returns the value of attribute region.



6
7
8
# File 'lib/mercury_banking/recipient.rb', line 6

def region
  @region
end

Instance Method Details

#jsonObject



28
29
30
31
# File 'lib/mercury_banking/recipient.rb', line 28

def json
  { name: @name, address: @address, emails: @emails, paymentMethod: @payment_method,
    electronicRoutingInfo: @electronic_routing_info }
end

#to_json(*_args) ⇒ Object



33
34
35
# File 'lib/mercury_banking/recipient.rb', line 33

def to_json(*_args)
  json.to_json
end