Class: CyberSourceMergedSpec::MerchantDescriptor38

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/merchant_descriptor38.rb

Overview

MerchantDescriptor38 Model.

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(address1: SKIP, administrative_area: SKIP, contact: SKIP, country: SKIP, county: SKIP, customer_service_phone_number: SKIP, locality: SKIP, name: SKIP, phone: SKIP, postal_code: SKIP, additional_properties: nil) ⇒ MerchantDescriptor38

Returns a new instance of MerchantDescriptor38.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 94

def initialize(address1: SKIP, administrative_area: SKIP, contact: SKIP,
               country: SKIP, county: SKIP,
               customer_service_phone_number: SKIP, locality: SKIP,
               name: SKIP, phone: SKIP, postal_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address1 = address1 unless address1 == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @contact = contact unless contact == SKIP
  @country = country unless country == SKIP
  @county = county unless county == SKIP
  unless customer_service_phone_number == SKIP
    @customer_service_phone_number =
      customer_service_phone_number
  end
  @locality = locality unless locality == SKIP
  @name = name unless name == SKIP
  @phone = phone unless phone == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1String

First line of merchant's address.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 14

def address1
  @address1
end

#administrative_areaString

The state where the merchant is located.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 18

def administrative_area
  @administrative_area
end

#contactString

Contact information for the merchant. This field contains additional information for contacting the merchant, such as an additional phone number or a contact name.

Returns:

  • (String)


24
25
26
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 24

def contact
  @contact
end

#countryString

Merchant's country.

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 28

def country
  @country
end

#countyString

Merchant's county. Used for US Merchants only. Send a 3-digit numeric FIPS county code. https://www2.census.gov/programs-surveys/decennial/2010/partners/pdf/FIPS_ StateCounty_Code.pdf

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 35

def county
  @county
end

#customer_service_phone_numberString

Indicates customer service phone number of Merchant.

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 39

def customer_service_phone_number
  @customer_service_phone_number
end

#localityString

Merchant's City.

Returns:

  • (String)


43
44
45
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 43

def locality
  @locality
end

#nameString

Merchant's name.

Returns:

  • (String)


47
48
49
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 47

def name
  @name
end

#phoneString

Merchant's phone.

Returns:

  • (String)


51
52
53
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 51

def phone
  @phone
end

#postal_codeString

Merchant's postal code.

Returns:

  • (String)


55
56
57
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 55

def postal_code
  @postal_code
end

Class Method Details

.from_element(root) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 157

def self.from_element(root)
  address1 = XmlUtilities.from_element(root, 'address1', String)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  contact = XmlUtilities.from_element(root, 'contact', String)
  country = XmlUtilities.from_element(root, 'country', String)
  county = XmlUtilities.from_element(root, 'county', String)
  customer_service_phone_number = XmlUtilities.from_element(
    root, 'customerServicePhoneNumber', String
  )
  locality = XmlUtilities.from_element(root, 'locality', String)
  name = XmlUtilities.from_element(root, 'name', String)
  phone = XmlUtilities.from_element(root, 'phone', String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)

  new(address1: address1,
      administrative_area: administrative_area,
      contact: contact,
      country: country,
      county: county,
      customer_service_phone_number: customer_service_phone_number,
      locality: locality,
      name: name,
      phone: phone,
      postal_code: postal_code,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  contact = hash.key?('contact') ? hash['contact'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  county = hash.key?('county') ? hash['county'] : SKIP
  customer_service_phone_number =
    hash.key?('customerServicePhoneNumber') ? hash['customerServicePhoneNumber'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP

  # 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.
  MerchantDescriptor38.new(address1: address1,
                           administrative_area: administrative_area,
                           contact: contact,
                           country: country,
                           county: county,
                           customer_service_phone_number: customer_service_phone_number,
                           locality: locality,
                           name: name,
                           phone: phone,
                           postal_code: postal_code,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address1'] = 'address1'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['contact'] = 'contact'
  @_hash['country'] = 'country'
  @_hash['county'] = 'county'
  @_hash['customer_service_phone_number'] = 'customerServicePhoneNumber'
  @_hash['locality'] = 'locality'
  @_hash['name'] = 'name'
  @_hash['phone'] = 'phone'
  @_hash['postal_code'] = 'postalCode'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 90

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 74

def self.optionals
  %w[
    address1
    administrative_area
    contact
    country
    county
    customer_service_phone_number
    locality
    name
    phone
    postal_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



218
219
220
221
222
223
224
225
226
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 218

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address1: #{@address1.inspect}, administrative_area:"\
  " #{@administrative_area.inspect}, contact: #{@contact.inspect}, country:"\
  " #{@country.inspect}, county: #{@county.inspect}, customer_service_phone_number:"\
  " #{@customer_service_phone_number.inspect}, locality: #{@locality.inspect}, name:"\
  " #{@name.inspect}, phone: #{@phone.inspect}, postal_code: #{@postal_code.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



208
209
210
211
212
213
214
215
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 208

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address1: #{@address1}, administrative_area: #{@administrative_area},"\
  " contact: #{@contact}, country: #{@country}, county: #{@county},"\
  " customer_service_phone_number: #{@customer_service_phone_number}, locality: #{@locality},"\
  " name: #{@name}, phone: #{@phone}, postal_code: #{@postal_code}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/cyber_source_merged_spec/models/merchant_descriptor38.rb', line 186

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'address1', address1)
  XmlUtilities.add_as_subelement(doc, root, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'contact', contact)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'county', county)
  XmlUtilities.add_as_subelement(doc, root, 'customerServicePhoneNumber',
                                 customer_service_phone_number)
  XmlUtilities.add_as_subelement(doc, root, 'locality', locality)
  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'phone', phone)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end