Class: FidorApi::Transfer::P2pUsername

Inherits:
Base show all
Includes:
Generic
Defined in:
lib/fidor_api/transfer/p2p_username.rb

Defined Under Namespace

Modules: ClientSupport

Constant Summary

Constants included from Generic

Generic::ROUTING_INFO_ERROR_PREFIX

Instance Attribute Summary

Attributes inherited from Base

#confirmable_action

Attributes inherited from Connectivity::Resource

#error_keys

Instance Method Summary collapse

Methods included from Generic

#as_json, included, required_attributes

Methods inherited from Base

#needs_confirmation?, #save

Methods inherited from Connectivity::Resource

all, find, #initialize, model_name, #persisted?, #reload, #save, #update_attributes

Constructor Details

This class inherits a constructor from FidorApi::Connectivity::Resource

Instance Method Details

#as_json_routing_infoObject



20
21
22
23
24
# File 'lib/fidor_api/transfer/p2p_username.rb', line 20

def as_json_routing_info
  {
    username: username
  }
end

#as_json_routing_typeObject



16
17
18
# File 'lib/fidor_api/transfer/p2p_username.rb', line 16

def as_json_routing_type
  "FOS_P2P_USERNAME"
end

#set_attributes(attrs = {}) ⇒ Object



10
11
12
13
14
# File 'lib/fidor_api/transfer/p2p_username.rb', line 10

def set_attributes(attrs = {})
  set_beneficiary_attributes(attrs)
  self.username = attrs.fetch("beneficiary", {}).fetch("routing_info", {})["username"]
  super(attrs.except("beneficiary"))
end