Class: Bcash::Api::AccountCreationRequest

Inherits:
BaseRequest
  • Object
show all
Defined in:
lib/bcash/api/request/account_creation_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccountCreationRequest

Returns a new instance of AccountCreationRequest.



10
11
12
13
14
# File 'lib/bcash/api/request/account_creation_request.rb', line 10

def initialize(attributes={})
  @address = AddressRequest.new(attributes.delete(:address))
  @owner = PersonRequest.new(attributes.delete(:owner))
  @contact = ContactRequest.new(attributes.delete(:contact))
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def address
  @address
end

#contactObject

Returns the value of attribute contact.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def contact
  @contact
end

Returns the value of attribute legal_person.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def legal_person
  @legal_person
end

#ownerObject

Returns the value of attribute owner.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def owner
  @owner
end

#transaction_modeObject Also known as: transactionMode

Returns the value of attribute transaction_mode.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def transaction_mode
  @transaction_mode
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/bcash/api/request/account_creation_request.rb', line 3

def url
  @url
end

Instance Method Details

#attributesObject



29
30
31
# File 'lib/bcash/api/request/account_creation_request.rb', line 29

def attributes
  { 'owner' => owner, 'legalPerson' => legal_person, 'address' => address, 'contact' => contact, 'url' => url, 'transactionMode' => transaction_mode }
end

#errors_full_messagesObject



24
25
26
27
# File 'lib/bcash/api/request/account_creation_request.rb', line 24

def errors_full_messages
  errors.full_messages + address.errors.full_messages + owner.errors.full_messages +
    contact.errors.full_messages
end

Returns:

  • (Boolean)


20
21
22
# File 'lib/bcash/api/request/account_creation_request.rb', line 20

def legal_person_valid?
  legal_person.present? ? legal_person.valid? : true
end

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/bcash/api/request/account_creation_request.rb', line 16

def valid?
  super && owner.valid? && address.valid? && contact.valid? && legal_person_valid?
end