Class: VisaAcceptanceMergedSpec::ServiceLocation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/service_location.rb

Overview

ServiceLocation 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(locality: SKIP, country_subdivision_code: SKIP, country_code: SKIP, postal_code: SKIP, additional_properties: nil) ⇒ ServiceLocation

Returns a new instance of ServiceLocation.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 62

def initialize(locality: SKIP, country_subdivision_code: SKIP,
               country_code: SKIP, postal_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @locality = locality unless locality == SKIP
  @country_subdivision_code = country_subdivision_code unless country_subdivision_code == SKIP
  @country_code = country_code unless country_code == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#country_codeString

Visa Platform Connect

Merchant’s service location country code. When merchant provides services from a location other than the location identified as merchant location.

Returns:

  • (String)


29
30
31
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 29

def country_code
  @country_code
end

#country_subdivision_codeString

Visa Platform Connect

Merchant’s service location country subdivision code. When merchant provides services from a location other than the location identified as merchant location.

Returns:

  • (String)


23
24
25
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 23

def country_subdivision_code
  @country_subdivision_code
end

#localityString

Visa Platform Connect

Merchant’s service location city name. When merchant provides services from a location other than the location identified as merchant location.

Returns:

  • (String)


16
17
18
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 16

def locality
  @locality
end

#postal_codeString

Visa Platform Connect

Merchant’s service location postal code. When merchant provides services from a location other than the location identified as merchant location.

Returns:

  • (String)


35
36
37
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 35

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  country_subdivision_code =
    hash.key?('countrySubdivisionCode') ? hash['countrySubdivisionCode'] : SKIP
  country_code = hash.key?('countryCode') ? hash['countryCode'] : 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.
  ServiceLocation.new(locality: locality,
                      country_subdivision_code: country_subdivision_code,
                      country_code: country_code,
                      postal_code: postal_code,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['locality'] = 'locality'
  @_hash['country_subdivision_code'] = 'countrySubdivisionCode'
  @_hash['country_code'] = 'countryCode'
  @_hash['postal_code'] = 'postalCode'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 48

def self.optionals
  %w[
    locality
    country_subdivision_code
    country_code
    postal_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} locality: #{@locality.inspect}, country_subdivision_code:"\
  " #{@country_subdivision_code.inspect}, country_code: #{@country_code.inspect}, postal_code:"\
  " #{@postal_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
107
# File 'lib/visa_acceptance_merged_spec/models/service_location.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} locality: #{@locality}, country_subdivision_code:"\
  " #{@country_subdivision_code}, country_code: #{@country_code}, postal_code:"\
  " #{@postal_code}, additional_properties: #{@additional_properties}>"
end