Class: FdxV660Api::BusinessCustomerEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/business_customer_entity.rb

Overview

Customers that are commercial in nature are affiliated with a business entity. Japanese participants should send 'Kana' values in name fields using the character set defined by Zengin (Japanese Banks' Payment Clearing Network)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(name: SKIP, registered_agents: SKIP, registered_id: SKIP, industry_code: SKIP, domicile: SKIP, additional_properties: nil) ⇒ BusinessCustomerEntity

Returns a new instance of BusinessCustomerEntity.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 63

def initialize(name: SKIP, registered_agents: SKIP, registered_id: SKIP,
               industry_code: SKIP, domicile: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name unless name == SKIP
  @registered_agents = registered_agents unless registered_agents == SKIP
  @registered_id = registered_id unless registered_id == SKIP
  @industry_code = industry_code unless industry_code == SKIP
  @domicile = domicile unless domicile == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#domicileDomicileEntity1

The country and region of the business customer's location

Returns:



34
35
36
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 34

def domicile
  @domicile
end

#industry_codeIndustryCode

Industry code and type

Returns:



30
31
32
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 30

def industry_code
  @industry_code
end

#nameString

Name of business customer

Returns:

  • (String)


17
18
19
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 17

def name
  @name
end

#registered_agentsArray[CustomerNameEntity]

A list of registered agents who act on behalf of the business customer

Returns:



21
22
23
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 21

def registered_agents
  @registered_agents
end

#registered_idString

The registered tax identification number (TIN) or other identifier of business customer

Returns:

  • (String)


26
27
28
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 26

def registered_id
  @registered_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  # Parameter is an array, so we need to iterate through it
  registered_agents = nil
  unless hash['registeredAgents'].nil?
    registered_agents = []
    hash['registeredAgents'].each do |structure|
      registered_agents << (CustomerNameEntity.from_hash(structure) if structure)
    end
  end

  registered_agents = SKIP unless hash.key?('registeredAgents')
  registered_id = hash.key?('registeredId') ? hash['registeredId'] : SKIP
  industry_code = IndustryCode.from_hash(hash['industryCode']) if hash['industryCode']
  domicile = DomicileEntity1.from_hash(hash['domicile']) if hash['domicile']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  BusinessCustomerEntity.new(name: name,
                             registered_agents: registered_agents,
                             registered_id: registered_id,
                             industry_code: industry_code,
                             domicile: domicile,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['registered_agents'] = 'registeredAgents'
  @_hash['registered_id'] = 'registeredId'
  @_hash['industry_code'] = 'industryCode'
  @_hash['domicile'] = 'domicile'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
56
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 48

def self.optionals
  %w[
    name
    registered_agents
    registered_id
    industry_code
    domicile
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, registered_agents: #{@registered_agents.inspect},"\
  " registered_id: #{@registered_id.inspect}, industry_code: #{@industry_code.inspect},"\
  " domicile: #{@domicile.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/fdx_v660_api/models/business_customer_entity.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, registered_agents: #{@registered_agents}, registered_id:"\
  " #{@registered_id}, industry_code: #{@industry_code}, domicile: #{@domicile},"\
  " additional_properties: #{@additional_properties}>"
end